private void assertFileAfterDeletion(Cache cache) {
Set<String> fileList = (Set<String>) cache.get(new FileListCacheKey(INDEX_NAME));
AssertJUnit.assertNotNull(fileList);
AssertJUnit.assertFalse(fileList.contains(filename));
FileMetadata metadata = (FileMetadata) cache.get(new FileCacheKey(INDEX_NAME, filename));
AssertJUnit.assertNotNull(metadata);
long totalFileSize = metadata.getSize();
int chunkNumbers = (int)(totalFileSize / CHUNK_SIZE);
for(int i = 0; i < chunkNumbers; i++) {
AssertJUnit.assertNotNull(cache.get(new ChunkCacheKey(INDEX_NAME, filename, i, CHUNK_SIZE)));
}
boolean fileNameExistsInCache = false;
for(Object key : cache.keySet()) {
if(key instanceof FileCacheKey) {
FileCacheKey keyObj = (FileCacheKey) key;
if(keyObj.getFileName().contains(filename)) {
fileNameExistsInCache = true;
}
}
}