use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testPriorityConversion.
public void testPriorityConversion() {
final AMQMessageHeader header = mock(AMQMessageHeader.class);
byte priority = (byte) 7;
when(header.getPriority()).thenReturn(priority);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected priority", priority, convertedMessage.getContentHeaderBody().getProperties().getPriority());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testReplyToConversionWhenQueueIsSpecified.
public void testReplyToConversionWhenQueueIsSpecified() {
final String replyTo = "testQueue";
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getReplyTo()).thenReturn(replyTo);
Queue queue = mock(Queue.class);
when(queue.getName()).thenReturn(replyTo);
when(_addressSpace.getAttainedMessageDestination(replyTo)).thenReturn(queue);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected reply-to", "direct:////" + replyTo, convertedMessage.getContentHeaderBody().getProperties().getReplyToAsString());
}
use of org.apache.qpid.server.message.internal.InternalMessage 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
}
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenExchangeAndRoutingKeyIsSpecified.
public void testToConversionWhenExchangeAndRoutingKeyIsSpecified() {
final String testExchange = "testExchange";
final String testRoutingKey = "testRoutingKey";
String to = testExchange + "/" + testRoutingKey;
InternalMessage message = createTestMessage(to);
Exchange<?> exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(testExchange);
when(_addressSpace.getAttainedMessageDestination(testExchange)).thenReturn(exchange);
final AMQMessage convertedMessage = _messageConverter.convert(message, _addressSpace);
final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
assertEquals("Unexpected exchange", testExchange, messagePublishInfo.getExchange().toString());
assertEquals("Unexpected routing key", testRoutingKey, messagePublishInfo.getRoutingKey().toString());
}
use of org.apache.qpid.server.message.internal.InternalMessage 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
}
}
Aggregations