* store after it has been reloaded. Both 0-8 and 0-10 metadata is used to
* verify their ability to co-exist within the store and be successful retrieved.
*/
public void testBDBMessagePersistence() throws Exception
{
MessageStore bdbStore = getStore();
// Create content ByteBuffers.
// Split the content into 2 chunks for the 0-8 message, as per broker behaviour.
// Use a single chunk for the 0-10 message as per broker behaviour.
String bodyText = "jfhdjsflsdhfjdshfjdslhfjdslhfsjlhfsjkhfdsjkhfdsjkfhdslkjf";
ByteBuffer firstContentBytes_0_8 = ByteBuffer.wrap(bodyText.substring(0, 10).getBytes());
ByteBuffer secondContentBytes_0_8 = ByteBuffer.wrap(bodyText.substring(10).getBytes());
ByteBuffer completeContentBody_0_10 = ByteBuffer.wrap(bodyText.getBytes());
int bodySize = completeContentBody_0_10.limit();
/*
* Create and insert a 0-8 message (metadata and multi-chunk content)
*/
MessagePublishInfo pubInfoBody_0_8 = createPublishInfoBody_0_8();
BasicContentHeaderProperties props_0_8 = createContentHeaderProperties_0_8();
ContentHeaderBody chb_0_8 = createContentHeaderBody_0_8(props_0_8, bodySize);
MessageMetaData messageMetaData_0_8 = new MessageMetaData(pubInfoBody_0_8, chb_0_8);
StoredMessage<MessageMetaData> storedMessage_0_8 = bdbStore.addMessage(messageMetaData_0_8);
long origArrivalTime_0_8 = messageMetaData_0_8.getArrivalTime();
long messageid_0_8 = storedMessage_0_8.getMessageNumber();
storedMessage_0_8.addContent(0, firstContentBytes_0_8);
storedMessage_0_8.addContent(firstContentBytes_0_8.limit(), secondContentBytes_0_8);
((AbstractBDBMessageStore.StoredBDBMessage)storedMessage_0_8).flushToStore();
/*
* Create and insert a 0-10 message (metadata and content)
*/
MessageProperties msgProps_0_10 = createMessageProperties_0_10(bodySize);
DeliveryProperties delProps_0_10 = createDeliveryProperties_0_10();
Header header_0_10 = new Header(delProps_0_10, msgProps_0_10);
MessageTransfer xfr_0_10 = new MessageTransfer("destination", MessageAcceptMode.EXPLICIT,
MessageAcquireMode.PRE_ACQUIRED, header_0_10, completeContentBody_0_10);
MessageMetaData_0_10 messageMetaData_0_10 = new MessageMetaData_0_10(xfr_0_10);
StoredMessage<MessageMetaData_0_10> storedMessage_0_10 = bdbStore.addMessage(messageMetaData_0_10);
long origArrivalTime_0_10 = messageMetaData_0_10.getArrivalTime();
long messageid_0_10 = storedMessage_0_10.getMessageNumber();
storedMessage_0_10.addContent(0, completeContentBody_0_10);