use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_0_10Test method testExpirationConversion.
public void testExpirationConversion() {
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
long timestamp = System.currentTimeMillis();
int ttl = 100000;
final long expiration = timestamp + ttl;
basicContentHeaderProperties.setExpiration(expiration);
basicContentHeaderProperties.setTimestamp(timestamp);
AMQMessage message = createTestMessage(basicContentHeaderProperties, timestamp);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected TTL", ttl, deliveryProperties.getTtl());
assertEquals("Unexpected expiration", expiration, deliveryProperties.getExpiration());
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_0_10Test method testHeaderConversion.
public void testHeaderConversion() {
Map<String, Object> headers = new HashMap<>();
headers.put("testProperty1", "testProperty1Value");
headers.put("intProperty", 1);
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
basicContentHeaderProperties.setHeaders(FieldTable.convertToFieldTable(headers));
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
Map<String, Object> applicationProperties = messageProperties.getApplicationHeaders();
assertEquals("Unexpected applicationProperties", headers, new HashMap<>(applicationProperties));
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_0_10Test method testContentTypeConversion.
public void testContentTypeConversion() {
String contentType = "test-content-type";
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
basicContentHeaderProperties.setContentType(contentType);
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
assertEquals("Unexpected content type", contentType, messageProperties.getContentType());
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_0_10Test method testUserIdConversion.
public void testUserIdConversion() {
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
final String userId = "test-userId";
basicContentHeaderProperties.setUserId(userId);
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
assertEquals("Unexpected user-id", userId, new String(messageProperties.getUserId(), UTF_8));
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_0_10Test method testUuidMessageIdWithPrefixConversion.
public void testUuidMessageIdWithPrefixConversion() {
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
final UUID messageId = UUID.randomUUID();
basicContentHeaderProperties.setMessageId("ID:" + messageId.toString());
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
assertEquals("Unexpected messageId", messageId, messageProperties.getMessageId());
}
Aggregations