int falsePositives = 0;
for(int i=0;i<TEST_COUNT;i++) {
String test = "test" + i;
ClientCHKBlock block = encodeBlockCHK(test);
ClientCHK key = block.getClientKey();
byte[] routingKey = key.getRoutingKey();
if(saltStore.probablyInStore(routingKey))
falsePositives++;
store.put(block.getBlock(), false);
assertTrue(saltStore.probablyInStore(routingKey));
CHKBlock verify = store.fetch(key.getNodeCHK(), false, false, null);
String data = decodeBlockCHK(verify, key);
assertEquals(test, data);
}
assertTrue(falsePositives == TEST_COUNT);
saltStore.close();
store = new CHKStore();
// Now turn on slot filters. Does it still work?
SaltedHashFreenetStore.NO_CLEANER_SLEEP = true;
saltStore = SaltedHashFreenetStore.construct(f, "testCachingFreenetStoreCHK", store, weakPRNG, STORE_SIZE, true, SemiOrderedShutdownHook.get(), true, true, ticker, null);
saltStore.start(null, true);
saltStore.testingWaitForCleanerDone(50, 100);
for(int i=0;i<TEST_COUNT;i++) {
String test = "test" + i;
ClientCHKBlock block = encodeBlockCHK(test);
ClientCHK key = block.getClientKey();
byte[] routingKey = key.getRoutingKey();
assertTrue(saltStore.probablyInStore(routingKey));
CHKBlock verify = store.fetch(key.getNodeCHK(), false, false, null);
String data = decodeBlockCHK(verify, key);
assertEquals(test, data);