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 testToConversionWhenDestinationIsSpecifiedButDoesNotExists.
public void testToConversionWhenDestinationIsSpecifiedButDoesNotExists() {
final String testDestination = "testDestination";
Properties properties = new Properties();
properties.setTo(testDestination);
Message_1_0 message = createTestMessage(properties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected exchange", "", deliveryProperties.getExchange());
assertEquals("Unexpected routing key", testDestination, 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 testSubjectConversion.
public void testSubjectConversion() {
final String subject = "testSubject";
Properties properties = new Properties();
properties.setSubject(subject);
Message_1_0 message = createTestMessage(properties);
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", 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 testToConversionWhenGlobalAddressIsUnknown.
public void testToConversionWhenGlobalAddressIsUnknown() {
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.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", globalAddress, 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 testDurableConversion.
public void testDurableConversion() {
final Header header = new Header();
header.setDurable(true);
Message_1_0 message = createTestMessage(header);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected deliveryMode", MessageDeliveryMode.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 testToConversionWhenExchangeIsSpecifiedAndSubjectIsSet.
public void testToConversionWhenExchangeIsSpecifiedAndSubjectIsSet() {
final String testExchange = "testExchange";
final String testRoutingKey = "testRoutingKey";
Properties properties = new Properties();
properties.setTo(testExchange);
properties.setSubject(testRoutingKey);
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", testRoutingKey, deliveryProperties.getRoutingKey());
}
Aggregations