use of org.apache.qpid.server.message.internal.InternalMessageMetaData in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v1_0Test method createTestMessage.
private InternalMessage createTestMessage(final AMQMessageHeader header, byte[] content, final boolean persistent) {
final InternalMessageHeader internalMessageHeader = new InternalMessageHeader(header);
final StoredMessage<InternalMessageMetaData> storedMessage = createInternalStoredMessage(content, persistent, internalMessageHeader);
return ((InternalMessage) InternalMessageMetaDataType.INSTANCE.createMessage(storedMessage));
}
use of org.apache.qpid.server.message.internal.InternalMessageMetaData in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method createInternalStoredMessage.
private StoredMessage<InternalMessageMetaData> createInternalStoredMessage(final byte[] content, final boolean persistent, final InternalMessageHeader internalMessageHeader) throws IOException {
final StoredMessage<InternalMessageMetaData> storedMessage = mock(StoredMessage.class);
int contentSize = content == null ? 0 : content.length;
if (contentSize > 0) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos)) {
oos.writeObject(content);
when(storedMessage.getContent(0, contentSize)).thenReturn(QpidByteBuffer.wrap(baos.toByteArray()));
}
}
when(storedMessage.getContentSize()).thenReturn(contentSize);
final InternalMessageMetaData metaData = new InternalMessageMetaData(persistent, internalMessageHeader, contentSize);
when(storedMessage.getMetaData()).thenReturn(metaData);
return storedMessage;
}
use of org.apache.qpid.server.message.internal.InternalMessageMetaData in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method createTestMessage.
private InternalMessage createTestMessage(final AMQMessageHeader header, byte[] content, final boolean persistent, final long arrivalTime) throws IOException {
final InternalMessageHeader internalMessageHeader = new InternalMessageHeader(header, arrivalTime);
final StoredMessage<InternalMessageMetaData> storedMessage = createInternalStoredMessage(content, persistent, internalMessageHeader);
return ((InternalMessage) InternalMessageMetaDataType.INSTANCE.createMessage(storedMessage));
}
use of org.apache.qpid.server.message.internal.InternalMessageMetaData in project qpid-broker-j by apache.
the class MessageConverter_Internal_to_1_0Test method getAmqMessage.
protected InternalMessage getAmqMessage(final Serializable content, final String mimeType) throws Exception {
final byte[] serializedContent = getObjectStreamMessageBytes(content);
configureMessageContent(serializedContent);
configureMessageHeader(mimeType);
final InternalMessageHeader internalMessageHeader = new InternalMessageHeader(_amqpHeader);
final int contentSize = serializedContent == null ? 0 : serializedContent.length;
final InternalMessageMetaData metaData = new InternalMessageMetaData(false, internalMessageHeader, contentSize);
when(_handle.getMetaData()).thenReturn(metaData);
return ((InternalMessage) InternalMessageMetaDataType.INSTANCE.createMessage(_handle));
}
use of org.apache.qpid.server.message.internal.InternalMessageMetaData in project qpid-broker-j by apache.
the class MessageConverter_Internal_to_0_8Test method getAmqMessage.
protected InternalMessage getAmqMessage(final Serializable content, final String mimeType) throws Exception {
final byte[] serializedContent = getObjectStreamMessageBytes(content);
configureMessageContent(serializedContent);
configureMessageHeader(mimeType);
final InternalMessageHeader internalMessageHeader = new InternalMessageHeader(_amqpHeader);
final int contentSize = serializedContent == null ? 0 : serializedContent.length;
final InternalMessageMetaData metaData = new InternalMessageMetaData(false, internalMessageHeader, contentSize);
when(_handle.getMetaData()).thenReturn(metaData);
return ((InternalMessage) InternalMessageMetaDataType.INSTANCE.createMessage(_handle));
}
Aggregations