use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method testPersistentTrueConversion.
public void testPersistentTrueConversion() throws IOException {
final AMQMessageHeader header = mock(AMQMessageHeader.class);
InternalMessage originalMessage = createTestMessage(header, null, true, System.currentTimeMillis());
MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected delivery mode", MessageDeliveryMode.PERSISTENT, convertedMessage.getHeader().getDeliveryProperties().getDeliveryMode());
assertTrue("Unexpected persistence of message", convertedMessage.isPersistent());
assertTrue("Unexpected persistence of meta data", convertedMessage.getStoredMessage().getMetaData().isPersistent());
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method testCorrelationIdConversionWhenLengthExceeds16Bits.
public void testCorrelationIdConversionWhenLengthExceeds16Bits() throws IOException {
final String correlationId = generateLongLongString();
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getCorrelationId()).thenReturn(correlationId);
InternalMessage originalMessage = createTestMessage(header);
try {
_messageConverter.convert(originalMessage, _addressSpace);
fail("Expected exception is not thrown");
} catch (MessageConversionException e) {
// pass
}
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method testUserIdConversion.
public void testUserIdConversion() throws IOException {
final String userId = "testUserId";
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getUserId()).thenReturn(userId);
InternalMessage originalMessage = createTestMessage(header);
MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertTrue("Unexpected userId", Arrays.equals(userId.getBytes(UTF_8), convertedMessage.getHeader().getMessageProperties().getUserId()));
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method testCorrelationIdConversion.
public void testCorrelationIdConversion() throws IOException {
String correlationId = "testCorrelationId";
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getCorrelationId()).thenReturn(correlationId);
InternalMessage originalMessage = createTestMessage(header);
MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertTrue("Unexpected correlationId", Arrays.equals(correlationId.getBytes(UTF_8), convertedMessage.getHeader().getMessageProperties().getCorrelationId()));
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method testPriorityConversion.
public void testPriorityConversion() throws IOException {
final AMQMessageHeader header = mock(AMQMessageHeader.class);
byte priority = (byte) 7;
when(header.getPriority()).thenReturn(priority);
InternalMessage originalMessage = createTestMessage(header);
MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected priority", priority, convertedMessage.getHeader().getDeliveryProperties().getPriority().getValue());
}
Aggregations