use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_1_0Test method testExpirationConversion.
public void testExpirationConversion() {
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
long timestamp = System.currentTimeMillis();
int ttl = 100000;
final long expiration = timestamp + ttl;
basicContentHeaderProperties.setExpiration(expiration);
AMQMessage message = createTestMessage(basicContentHeaderProperties, timestamp);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Header header = convertedMessage.getHeaderSection().getValue();
assertEquals("Unexpected TTL", ttl, header.getTtl().longValue());
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertNull("Unexpected expiration", properties.getAbsoluteExpiryTime());
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_1_0Test method testHeaderWithFieldArrayValueConversionFails.
public void testHeaderWithFieldArrayValueConversionFails() {
Map<String, Object> headers = Collections.singletonMap("listHeader", Collections.emptyList());
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
basicContentHeaderProperties.setHeaders(FieldTable.convertToFieldTable(headers));
AMQMessage message = createTestMessage(basicContentHeaderProperties);
try {
_messageConverter.convert(message, _namedAddressSpace);
fail("Exception is expected");
} catch (MessageConversionException e) {
// pass
}
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_1_0Test method testContentTypeJavaObjectStreamConversion.
public void testContentTypeJavaObjectStreamConversion() {
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
basicContentHeaderProperties.setContentType("application/java-object-stream");
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertEquals("Unexpected content type", "application/x-java-serialized-object", properties.getContentType().toString());
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_1_0Test method testTimestampConversion.
public void testTimestampConversion() {
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
final long timestamp = System.currentTimeMillis() - 10000;
basicContentHeaderProperties.setTimestamp(timestamp);
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertEquals("Unexpected creation timestamp", timestamp, properties.getCreationTime().getTime());
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_1_0Test method testReplyToConversionWhenBindingURLFormatIsUsed.
public void testReplyToConversionWhenBindingURLFormatIsUsed() {
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
final String replyTo = "direct://amq.direct/destination_name/queue_name?routingkey='test_routing_key'";
basicContentHeaderProperties.setReplyTo(replyTo);
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertEquals("Unexpected reply-to", "amq.direct/test_routing_key", properties.getReplyTo());
}
Aggregations