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 testApplicationIdConversion.
@Test
public void testApplicationIdConversion() {
final String applicationId = "appId";
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setAppId(applicationId);
final AMQMessage originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected applicationId", applicationId, convertedMessage.getMessageHeader().getAppId());
}
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 testReplyToNonBurl.
@Test
public void testReplyToNonBurl() {
final String replyTo = "test/routing";
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setReplyTo(replyTo);
final AMQMessage originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected replyTo", replyTo, convertedMessage.getMessageHeader().getReplyTo());
}
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 testContentEncodingConversion.
@Test
public void testContentEncodingConversion() {
String contentEncoding = "my-test-encoding";
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setEncoding(contentEncoding);
final AMQMessage originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected content encoding", contentEncoding, convertedMessage.getMessageHeader().getEncoding());
}
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 testReplyToConversionForDirectExchangeAndRoutingKey.
@Test
public void testReplyToConversionForDirectExchangeAndRoutingKey() {
String exchangeName = "amq.direct";
String routingKey = "testRoutingKey";
final String replyTo = String.format("%s://%s//?routingkey='%s'", "direct", exchangeName, routingKey);
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setReplyTo(replyTo);
final AMQMessage originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected replyTo", exchangeName + "/" + routingKey, convertedMessage.getMessageHeader().getReplyTo());
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class MessageFormat_0_9_1 method createMessage.
@Override
public AMQMessage createMessage(final QpidByteBuffer payload, final MessageStore store, final Object connectionReference) {
try {
AMQShortString exchange = readShortString(payload);
AMQShortString routingKey = readShortString(payload);
byte flags = payload.get();
final MessagePublishInfo publishBody = new MessagePublishInfo(exchange, (flags & IMMEDIATE_MASK) != 0, (flags & MANDATORY_MASK) != 0, routingKey);
final ContentHeaderBody contentHeaderBody = readContentBody(payload);
MessageMetaData mmd = new MessageMetaData(publishBody, contentHeaderBody);
final MessageHandle<MessageMetaData> handle = store.addMessage(mmd);
handle.addContent(payload);
final StoredMessage<MessageMetaData> storedMessage = handle.allContentAdded();
return new AMQMessage(storedMessage, connectionReference);
} catch (AMQFrameDecodingException | BufferUnderflowException e) {
throw new ConnectionScopedRuntimeException("Error parsing AMQP 0-9-1 message format", e);
}
}
Aggregations