use of org.apache.qpid.server.protocol.v1_0.MessageConverter_from_1_0.getAmqp0xConvertedContentAndMimeType in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v1_0Test method testMessageIdUnsignedLongConversion.
public void testMessageIdUnsignedLongConversion() {
final UnsignedLong messageId = UnsignedLong.valueOf(-1L);
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getMessageId()).thenReturn(messageId.toString());
InternalMessage originalMessage = createTestMessage(header);
Message_1_0 convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
Object convertedMessageId = MessageConverter_from_1_0.getMessageId(convertedMessage);
assertEquals("Unexpected messageId", messageId, convertedMessageId);
}
use of org.apache.qpid.server.protocol.v1_0.MessageConverter_from_1_0.getAmqp0xConvertedContentAndMimeType in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v1_0Test method testExpirationConversion.
public void testExpirationConversion() throws InterruptedException {
long ttl = 10000;
long expiryTime = System.currentTimeMillis() + ttl;
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getExpiration()).thenReturn(expiryTime);
InternalMessage originalMessage = createTestMessage(header);
Thread.sleep(1L);
Message_1_0 convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
Long convertedTtl = MessageConverter_from_1_0.getTtl(convertedMessage);
assertEquals("Unexpected TTL", expiryTime - originalMessage.getArrivalTime(), convertedTtl.longValue());
}
use of org.apache.qpid.server.protocol.v1_0.MessageConverter_from_1_0.getAmqp0xConvertedContentAndMimeType in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v1_0Test method testUserIdConversion.
public void testUserIdConversion() {
final String userId = "testUserId";
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getUserId()).thenReturn(userId);
InternalMessage originalMessage = createTestMessage(header);
Message_1_0 convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
Binary convertedUserId = MessageConverter_from_1_0.getUserId(convertedMessage);
assertTrue("Unexpected userId", Arrays.equals(userId.getBytes(UTF_8), convertedUserId.getArray()));
}
Aggregations