use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenExchangeIsSpecified.
@Test
public void testToConversionWhenExchangeIsSpecified() {
final String testExchange = "testExchange";
InternalMessage message = createTestMessage(testExchange);
final Exchange exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(testExchange);
doReturn(exchange).when(_addressSpace).getAttainedMessageDestination(eq(testExchange), anyBoolean());
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.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenGlobalAddressIsUnknown.
@Test
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);
doReturn(queue).when(_addressSpace).getAttainedMessageDestination(eq(queueName), anyBoolean());
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.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenDestinationIsSpecifiedButDoesNotExists.
@Test
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.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_v0_8_to_InternalTest method testBasicPublishConversion.
@Test
public void testBasicPublishConversion() {
final String exchangeName = "amq.direct";
final String testRoutingKey = "test-routing-key";
final AMQMessage originalMessage = createTestMessage(new BasicContentHeaderProperties());
originalMessage.getMessagePublishInfo().setRoutingKey(AMQShortString.valueOf(testRoutingKey));
originalMessage.getMessagePublishInfo().setExchange(AMQShortString.valueOf(exchangeName));
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected to", exchangeName, convertedMessage.getTo());
// TODO: QPID-7868 : add test for initialRoutingAddress
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_v0_8_to_InternalTest method testReplyToConversionForFanoutExchange.
@Test
public void testReplyToConversionForFanoutExchange() {
String exchangeName = "amq.fanout";
final String replyTo = String.format("%s://%s//", "fanout", exchangeName);
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setReplyTo(replyTo);
final AMQMessage originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected replyTo", exchangeName, convertedMessage.getMessageHeader().getReplyTo());
}
Aggregations