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 testToConversionWhenGlobalAddressIsKnown.
public void testToConversionWhenGlobalAddressIsKnown() {
final String queueName = "testQueue";
final String prefix = "/testPrefix";
final String globalAddress = prefix + "/" + queueName;
Properties properties = new Properties();
properties.setTo(globalAddress);
Message_1_0 message = createTestMessage(properties);
final Queue<?> queue = mock(Queue.class);
when(queue.getName()).thenReturn(queueName);
when(_namedAddressSpace.getLocalAddress(globalAddress)).thenReturn(queueName);
when(_namedAddressSpace.getAttainedMessageDestination(queueName)).thenReturn(queue);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected exchange", "", deliveryProperties.getExchange());
assertEquals("Unexpected routing key", queueName, 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 testSubjectDoesNoReplaceApplicationPropertyQpidSubject.
public void testSubjectDoesNoReplaceApplicationPropertyQpidSubject() {
final String subject = "testSubject";
Properties properties = new Properties();
properties.setSubject(subject);
final String qpidSubject = "testSubject2";
Map<String, Object> applicationPropertiesMap = Collections.singletonMap("qpid.subject", qpidSubject);
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", qpidSubject, headers.get("qpid.subject"));
assertEquals("Unexpected type", subject, 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 testCreationTimeConversion.
public void testCreationTimeConversion() {
final long timestamp = System.currentTimeMillis() - 10000;
final long arrivalTime = timestamp + 1;
Properties properties = new Properties();
properties.setCreationTime(new Date(timestamp));
Message_1_0 message = createTestMessage(new 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 timestamp", timestamp, deliveryProperties.getTimestamp());
}
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 testArrivalTimeConversion.
public void testArrivalTimeConversion() {
final long arrivalTime = System.currentTimeMillis() - 10000;
Message_1_0 message = createTestMessage(new Header(), arrivalTime);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected timestamp", arrivalTime, deliveryProperties.getTimestamp());
}
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 testPriorityConversion.
public void testPriorityConversion() {
final Header header = new Header();
final byte priority = (byte) 7;
header.setPriority(UnsignedByte.valueOf(priority));
Message_1_0 message = createTestMessage(header);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected priority", priority, deliveryProperties.getPriority().getValue());
}
Aggregations