use of org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testNonDurableConversion.
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.v0_10.transport.DeliveryProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testToConversionWhenExchangeIsSpecified.
public void testToConversionWhenExchangeIsSpecified() {
final String testExchange = "testExchange";
Properties properties = new Properties();
properties.setTo(testExchange);
Message_1_0 message = createTestMessage(properties);
final Exchange<?> exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(testExchange);
when(_namedAddressSpace.getAttainedMessageDestination(testExchange)).thenReturn(exchange);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected exchange", testExchange, deliveryProperties.getExchange());
assertEquals("Unexpected routing key", "", deliveryProperties.getRoutingKey());
}
use of org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testTTLConversion.
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.v0_10.transport.DeliveryProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testSubjectDoesNoReplaceApplicationPropertyXJMSType.
public void testSubjectDoesNoReplaceApplicationPropertyXJMSType() {
final String subject = "testSubject";
Properties properties = new Properties();
properties.setSubject(subject);
final String jmsType = "testJmsType";
Map<String, Object> applicationPropertiesMap = Collections.singletonMap("x-jms-type", jmsType);
ApplicationProperties applicationProperties = new ApplicationProperties(applicationPropertiesMap);
Message_1_0 message = createTestMessage(new Header(), new DeliveryAnnotations(Collections.emptyMap()), new MessageAnnotations(Collections.emptyMap()), properties, applicationProperties, 0, null);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
final Map<String, Object> headers = messageProperties.getApplicationHeaders();
assertEquals("Unexpected qpid.subject is missing from headers", subject, headers.get("qpid.subject"));
assertEquals("Unexpected type", jmsType, headers.get("x-jms-type"));
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected routing-key", subject, deliveryProperties.getRoutingKey());
}
use of org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testConversionOfTtlTakesPrecedenceOverAbsoluteExpiryTime.
public void testConversionOfTtlTakesPrecedenceOverAbsoluteExpiryTime() {
long ttl = 10000;
final long time = System.currentTimeMillis();
long absoluteExpiryTime = time + ttl;
long arrivalTime = time + 1;
Header header = new Header();
header.setTtl(UnsignedInteger.valueOf(ttl));
Properties properties = new Properties();
properties.setAbsoluteExpiryTime(new Date(absoluteExpiryTime));
Message_1_0 message = createTestMessage(header, new DeliveryAnnotations(Collections.emptyMap()), new MessageAnnotations(Collections.emptyMap()), properties, new ApplicationProperties(Collections.emptyMap()), arrivalTime, null);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected ttl", ttl, deliveryProperties.getTtl());
assertEquals("Unexpected expiration", arrivalTime + ttl, deliveryProperties.getExpiration());
}
Aggregations