VirtualHost testVhost = registry.getVirtualHostRegistry().getVirtualHost(VHOST);
assertNotNull("Unable to get test Vhost", testVhost.getMessageStore());
TestableMemoryMessageStore store = new TestableMemoryMessageStore((MemoryMessageStore) testVhost.getMessageStore());
assertNotNull("ContentBodyMap should not be null", store.getContentBodyMap());
// If the CBM has content it may be due to the broker not yet purging.
// Closing the producer connection before testing should give the store time to clean up.
// Perform a quick sleep just in case
while (store.getContentBodyMap().size() > _initialContentBodyMapSize)
{
try
{
Thread.sleep(500);
}
catch (InterruptedException e)
{
}
}
assertTrue("Expected the store content size not reached at test start it was :" + _initialContentBodyMapSize + " Now it is :" + store.getContentBodyMap().size(), _initialContentBodyMapSize >= store.getContentBodyMap().size());
assertNotNull("MessageMetaDataMap should not be null", store.getMessageMetaDataMap());
assertTrue("Expected the store MessageMetaData size not reached at test start it was :" + _initilaMessageMetaDataMapSize + " Now it is :" + store.getMessageMetaDataMap().size(), _initialContentBodyMapSize >= store.getMessageMetaDataMap().size());
}