Search in sources :

Example 11 with MessageMetaData

use of org.apache.qpid.server.protocol.v0_8.MessageMetaData in project qpid-broker-j by apache.

the class PropertyConverter_0_8_to_0_10Test method createTestMessage.

private AMQMessage createTestMessage(final BasicContentHeaderProperties basicContentHeaderProperties, final byte[] content, final long arrivalTime) {
    final ContentHeaderBody contentHeaderBody = mock(ContentHeaderBody.class);
    when(contentHeaderBody.getProperties()).thenReturn(basicContentHeaderProperties);
    final StoredMessage<MessageMetaData> storedMessage = mock(StoredMessage.class);
    when(storedMessage.getMetaData()).thenReturn(new MessageMetaData(new MessagePublishInfo(), contentHeaderBody, arrivalTime));
    if (content != null) {
        when(storedMessage.getContentSize()).thenReturn(content.length);
        when(storedMessage.getContent(0, content.length)).thenReturn(QpidByteBuffer.wrap(content));
    } else {
        when(storedMessage.getContentSize()).thenReturn(0);
        when(storedMessage.getContent(0, 0)).thenReturn(QpidByteBuffer.emptyQpidByteBuffer());
    }
    return new AMQMessage(storedMessage);
}
Also used : MessageMetaData(org.apache.qpid.server.protocol.v0_8.MessageMetaData) MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo) ContentHeaderBody(org.apache.qpid.server.protocol.v0_8.transport.ContentHeaderBody) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 12 with MessageMetaData

use of org.apache.qpid.server.protocol.v0_8.MessageMetaData in project qpid-broker-j by apache.

the class PropertyConverter_v0_8_to_InternalTest method createTestMessage.

private AMQMessage createTestMessage(final BasicContentHeaderProperties basicContentHeaderProperties, final byte[] content, final long arrivalTime) {
    final ContentHeaderBody contentHeaderBody = mock(ContentHeaderBody.class);
    when(contentHeaderBody.getProperties()).thenReturn(basicContentHeaderProperties);
    final StoredMessage<MessageMetaData> storedMessage = mock(StoredMessage.class);
    when(storedMessage.getMetaData()).thenReturn(new MessageMetaData(new MessagePublishInfo(), contentHeaderBody, arrivalTime));
    if (content != null) {
        when(storedMessage.getContentSize()).thenReturn(content.length);
        when(storedMessage.getContent(0, content.length)).thenReturn(QpidByteBuffer.wrap(content));
    } else {
        when(storedMessage.getContentSize()).thenReturn(0);
        when(storedMessage.getContent(0, 0)).thenReturn(QpidByteBuffer.emptyQpidByteBuffer());
    }
    return new AMQMessage(storedMessage);
}
Also used : MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo) ContentHeaderBody(org.apache.qpid.server.protocol.v0_8.transport.ContentHeaderBody)

Aggregations

ContentHeaderBody (org.apache.qpid.server.protocol.v0_8.transport.ContentHeaderBody)10 MessagePublishInfo (org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo)10 MessageMetaData (org.apache.qpid.server.protocol.v0_8.MessageMetaData)6 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)4 StoredMessage (org.apache.qpid.server.store.StoredMessage)4 LinkedHashMap (java.util.LinkedHashMap)2 MessageReference (org.apache.qpid.server.message.MessageReference)2 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)2 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)2 Transaction (org.apache.qpid.server.store.Transaction)2 BufferUnderflowException (java.nio.BufferUnderflowException)1 Date (java.util.Date)1 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)1 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)1 FieldTable (org.apache.qpid.server.protocol.v0_8.FieldTable)1 ConvertedContentAndMimeType (org.apache.qpid.server.protocol.v1_0.MessageConverter_from_1_0.ConvertedContentAndMimeType)1 MessageConverter_from_1_0.getAmqp0xConvertedContentAndMimeType (org.apache.qpid.server.protocol.v1_0.MessageConverter_from_1_0.getAmqp0xConvertedContentAndMimeType)1 MessageMetaData_1_0 (org.apache.qpid.server.protocol.v1_0.MessageMetaData_1_0)1 UnsignedInteger (org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger)1 ConnectionScopedRuntimeException (org.apache.qpid.server.util.ConnectionScopedRuntimeException)1