String msgBase = StringTools.rightPad("DATA-", 1000, 'X');
byte[] data = msgBase.getBytes();
System.setProperty("ffmq.dataStore.keepJournalFiles", "true");
BlockBasedDataStoreTools.create(storeId, new File("target/test"), 2000, 512, true);
LinkedDataStore store = createStore(storeId, new File("target/test"));
for (int i = 0; i < 100; i++)
{
for (int j = 0; j < 10; j++)
{
int previous = store.first();
previous = store.store(data, previous);
if (previous == -1)
throw new IllegalStateException("No space left !");
}
store.commitChanges();
for (int j = 0; j < 10; j++)
{
store.delete(store.first());
}
store.commitChanges();
}
assertEquals(0, store.size());
store.close();
System.setProperty("ffmq.dataStore.keepJournalFiles", "false");
store = createStore(storeId, new File("target/test"));
assertEquals(0, store.size());
store.close();
store = createStore(storeId, new File("target/test"));
assertEquals(0, store.size());
store.close();
}