use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenExchangeIsSpecified.
public void testToConversionWhenExchangeIsSpecified() {
final String testExchange = "testExchange";
InternalMessage message = createTestMessage(testExchange);
final Exchange exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(testExchange);
when(_addressSpace.getAttainedMessageDestination(testExchange)).thenReturn(exchange);
final AMQMessage convertedMessage = _messageConverter.convert(message, _addressSpace);
final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
assertEquals("Unexpected exchange", testExchange, messagePublishInfo.getExchange().toString());
assertEquals("Unexpected routing key", "", messagePublishInfo.getRoutingKey().toString());
}
use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenQueueIsSpecified.
public void testToConversionWhenQueueIsSpecified() {
final String testQueue = "testQueue";
InternalMessage message = createTestMessage(testQueue);
final Queue queue = mock(Queue.class);
when(queue.getName()).thenReturn(testQueue);
when(_addressSpace.getAttainedMessageDestination(testQueue)).thenReturn(queue);
final AMQMessage convertedMessage = _messageConverter.convert(message, _addressSpace);
final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
assertEquals("Unexpected exchange", "", messagePublishInfo.getExchange().toString());
assertEquals("Unexpected routing key", testQueue, messagePublishInfo.getRoutingKey().toString());
}
use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenDestinationIsSpecifiedButDoesNotExists.
public void testToConversionWhenDestinationIsSpecifiedButDoesNotExists() {
final String testDestination = "testDestination";
InternalMessage message = createTestMessage(testDestination);
final AMQMessage convertedMessage = _messageConverter.convert(message, _addressSpace);
final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
assertEquals("Unexpected exchange", "", messagePublishInfo.getExchange().toString());
assertEquals("Unexpected routing key", testDestination, messagePublishInfo.getRoutingKey().toString());
}
use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenGlobalAddressIsUnknown.
public void testToConversionWhenGlobalAddressIsUnknown() {
final String globalPrefix = "/testPrefix";
final String queueName = "testQueue";
final String globalAddress = globalPrefix + "/" + queueName;
InternalMessage message = createTestMessage(globalAddress);
Queue<?> queue = mock(Queue.class);
when(queue.getName()).thenReturn(queueName);
when(_addressSpace.getAttainedMessageDestination(queueName)).thenReturn(queue);
final AMQMessage convertedMessage = _messageConverter.convert(message, _addressSpace);
final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
assertEquals("Unexpected exchange", "", messagePublishInfo.getExchange().toString());
assertEquals("Unexpected routing key", globalAddress, messagePublishInfo.getRoutingKey().toString());
}
use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testConversionWhenToIsUnsetButInitialRoutingKeyIsSet.
public void testConversionWhenToIsUnsetButInitialRoutingKeyIsSet() {
final String testExchange = "testExchange";
final String testRoutingKey = "testRoutingKey";
InternalMessage message = createTestMessage("");
final String testInitialRoutingAddress = testExchange + "/" + testRoutingKey;
message.setInitialRoutingAddress(testInitialRoutingAddress);
final Exchange exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(testExchange);
when(_addressSpace.getAttainedMessageDestination(testExchange)).thenReturn(exchange);
final AMQMessage convertedMessage = _messageConverter.convert(message, _addressSpace);
final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
assertEquals("Unexpected exchange", testExchange, messagePublishInfo.getExchange().toString());
assertEquals("Unexpected routing key", testRoutingKey, messagePublishInfo.getRoutingKey().toString());
}
Aggregations