use of org.apache.qpid.server.protocol.v1_0.type.messaging.Header in project qpid-broker-j by apache.
the class PropertyConverter_v1_0_to_InternalTest method testDurableFalseConversion.
@Test
public void testDurableFalseConversion() {
final Header header = new Header();
header.setDurable(false);
final Message_1_0 originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertFalse("Unexpected persistence of message", convertedMessage.isPersistent());
assertFalse("Unexpected persistence of meta data", convertedMessage.getStoredMessage().getMetaData().isPersistent());
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.Header in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testTTLConversion.
@Test
public void testTTLConversion() {
long ttl = 10000;
long arrivalTime = System.currentTimeMillis();
long expectedExpiration = arrivalTime + ttl;
Header header = new Header();
header.setTtl(UnsignedInteger.valueOf(ttl));
Message_1_0 message = createTestMessage(header, arrivalTime);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected ttl", ttl, deliveryProperties.getTtl());
assertEquals("Unexpected expiration", expectedExpiration, deliveryProperties.getExpiration());
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.Header in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testNonDurableConversion.
@Test
public void testNonDurableConversion() {
final Header header = new Header();
header.setDurable(false);
Message_1_0 message = createTestMessage(header);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected deliveryMode", MessageDeliveryMode.NON_PERSISTENT, deliveryProperties.getDeliveryMode());
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.Header in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method createTestMessage.
private Message_1_0 createTestMessage(final Header header, final DeliveryAnnotations deliveryAnnotations, final MessageAnnotations messageAnnotations, final Properties properties, final ApplicationProperties applicationProperties, final long arrivalTime) {
final StoredMessage<MessageMetaData_1_0> storedMessage = mock(StoredMessage.class);
when(storedMessage.getContentSize()).thenReturn(0);
when(storedMessage.getContent(0, 0)).thenReturn(QpidByteBuffer.emptyQpidByteBuffer());
MessageMetaData_1_0 metaData = new MessageMetaData_1_0(header.createEncodingRetainingSection(), deliveryAnnotations.createEncodingRetainingSection(), messageAnnotations.createEncodingRetainingSection(), properties.createEncodingRetainingSection(), applicationProperties.createEncodingRetainingSection(), new Footer(Collections.emptyMap()).createEncodingRetainingSection(), arrivalTime, 0);
when(storedMessage.getMetaData()).thenReturn(metaData);
return new Message_1_0(storedMessage);
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.Header in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testArrivalTimeConversion.
@Test
public void testArrivalTimeConversion() {
final long arrivalTime = System.currentTimeMillis() - 10000;
Message_1_0 message = createTestMessage(new Header(), arrivalTime);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected timestamp", arrivalTime, convertedProperties.getTimestamp());
}
Aggregations