use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test 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 AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected expiration", expectedExpiration, convertedProperties.getExpiration());
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_v0_8_to_InternalTest method testExpirationConversion.
@Test
public void testExpirationConversion() {
long ttl = 10000;
long arrivalTime = System.currentTimeMillis();
long expiryTime = arrivalTime + ttl;
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setExpiration(expiryTime);
final AMQMessage originalMessage = createTestMessage(header, arrivalTime);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected expiration", expiryTime, convertedMessage.getMessageHeader().getExpiration());
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_v0_8_to_InternalTest method testHeadersConversion.
@Test
public void testHeadersConversion() {
Map<String, Object> properties = new HashMap<>();
properties.put("testProperty1", "testProperty1Value");
properties.put("intProperty", 1);
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setHeaders(FieldTable.convertToFieldTable(properties));
final AMQMessage originalMessage = createTestMessage(header);
final InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
final Map<String, Object> headers = convertedMessage.getMessageHeader().getHeaderMap();
assertEquals("Unexpected headers", properties, new HashMap<>(headers));
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_v0_8_to_InternalTest method testDeliveryModePersistentConversion.
@Test
public void testDeliveryModePersistentConversion() {
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setDeliveryMode(BasicContentHeaderProperties.PERSISTENT);
final AMQMessage originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertTrue("Unexpected persistence of message", convertedMessage.isPersistent());
assertTrue("Unexpected persistence of meta data", convertedMessage.getStoredMessage().getMetaData().isPersistent());
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_v0_8_to_InternalTest method testUserIdConversion.
@Test
public void testUserIdConversion() {
final String userId = "testUserId";
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setUserId(userId);
final AMQMessage originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected userId", userId, convertedMessage.getMessageHeader().getUserId());
}
Aggregations