use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testUserIdConversionWhenLengthExceeds255.
public void testUserIdConversionWhenLengthExceeds255() {
final String userId = generateLongString();
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getUserId()).thenReturn(userId);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertNull("Unexpected userId", convertedMessage.getContentHeaderBody().getProperties().getUserId());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenRoutingKeyLengthExceeds255.
public void testToConversionWhenRoutingKeyLengthExceeds255() {
final String testExchange = "testExchange";
final String testRoutingKey = generateLongString();
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 testReplyToConversionWhenExchangeIsSpecified.
public void testReplyToConversionWhenExchangeIsSpecified() {
final String replyTo = "testExchange";
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getReplyTo()).thenReturn(replyTo);
Exchange exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(replyTo);
when(exchange.getType()).thenReturn(ExchangeDefaults.FANOUT_EXCHANGE_CLASS);
when(_addressSpace.getAttainedMessageDestination(replyTo)).thenReturn(exchange);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected reply-to", "fanout://" + 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 testTimestampConversion.
public void testTimestampConversion() {
final long timestamp = System.currentTimeMillis();
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getTimestamp()).thenReturn(timestamp);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected timestamp", timestamp, convertedMessage.getContentHeaderBody().getProperties().getTimestamp());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testMessageIdConversionWhenLengthExceeds255.
public void testMessageIdConversionWhenLengthExceeds255() {
final String messageId = generateLongString();
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getMessageId()).thenReturn(messageId);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertNull("Unexpected messageId", convertedMessage.getContentHeaderBody().getProperties().getMessageId());
}
Aggregations