use of org.apache.qpid.server.protocol.v0_10.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_InternalTest method testApplicationIdConversion.
public void testApplicationIdConversion() {
String applicationId = "testAppId";
MessageProperties messageProperties = new MessageProperties();
messageProperties.setAppId(applicationId.getBytes(UTF_8));
MessageTransferMessage message = createTestMessage(messageProperties);
final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
assertEquals("Unexpected app-id", applicationId, convertedMessage.getMessageHeader().getAppId());
}
use of org.apache.qpid.server.protocol.v0_10.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_InternalTest method testInitialRoutingAddressConversion.
public void testInitialRoutingAddressConversion() {
final String testExchange = "testExchange";
final DeliveryProperties deliveryProperties = new DeliveryProperties();
deliveryProperties.setExchange(testExchange);
final String testRoutingKey = "testRoutingKey";
deliveryProperties.setRoutingKey(testRoutingKey);
MessageTransferMessage message = createTestMessage(deliveryProperties);
final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
assertEquals("Unexpected initial routing address", testRoutingKey, convertedMessage.getInitialRoutingAddress());
}
use of org.apache.qpid.server.protocol.v0_10.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_InternalTest method testPersistentDeliveryModeConversion.
public void testPersistentDeliveryModeConversion() {
MessageDeliveryMode deliveryMode = MessageDeliveryMode.PERSISTENT;
final DeliveryProperties deliveryProperties = new DeliveryProperties();
deliveryProperties.setDeliveryMode(deliveryMode);
MessageTransferMessage message = createTestMessage(deliveryProperties);
final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
assertTrue("Unexpected persistence", convertedMessage.isPersistent());
assertTrue("Unexpected persistence of meta data", convertedMessage.getStoredMessage().getMetaData().isPersistent());
}
use of org.apache.qpid.server.protocol.v0_10.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method testReplyToConversionWhenExchangeAndRoutingKeyAreSpecified.
public void testReplyToConversionWhenExchangeAndRoutingKeyAreSpecified() throws IOException {
final AMQMessageHeader header = mock(AMQMessageHeader.class);
final String exchangeName = "testExchnageName";
final String routingKey = "testRoutingKey";
final String replyTo = String.format("%s/%s", exchangeName, routingKey);
final Exchange exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(exchangeName);
when(_addressSpace.getAttainedMessageDestination(exchangeName)).thenReturn(exchange);
when(header.getReplyTo()).thenReturn(replyTo);
InternalMessage originalMessage = createTestMessage(header);
MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
final ReplyTo convertedReplyTo = convertedMessage.getHeader().getMessageProperties().getReplyTo();
assertEquals("Unexpected exchange", exchangeName, convertedReplyTo.getExchange());
assertEquals("Unexpected routing key", routingKey, convertedReplyTo.getRoutingKey());
}
use of org.apache.qpid.server.protocol.v0_10.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method testReplyToConversionWhenExchangeIsSpecified.
public void testReplyToConversionWhenExchangeIsSpecified() throws IOException {
final AMQMessageHeader header = mock(AMQMessageHeader.class);
final String replyTo = "myTestExchange";
final Exchange exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(replyTo);
when(_addressSpace.getAttainedMessageDestination(replyTo)).thenReturn(exchange);
when(header.getReplyTo()).thenReturn(replyTo);
InternalMessage originalMessage = createTestMessage(header);
MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
final ReplyTo convertedReplyTo = convertedMessage.getHeader().getMessageProperties().getReplyTo();
assertEquals("Unexpected exchange", replyTo, convertedReplyTo.getExchange());
assertEquals("Unexpected routing key", "", convertedReplyTo.getRoutingKey());
}
Aggregations