@After
  public void cleanup() throws IOException, StoreException {
    Utils.shutDownExecutorService(scheduler, 5, TimeUnit.SECONDS);
    Utils.shutDownExecutorService(storeStatsScheduler, 5, TimeUnit.SECONDS);
    if (store.isStarted()) {
      if (enableIndexDirectMemoryUsageMetric) {
        assertTrue(storeMetrics.indexes.containsKey(store.getReplicaId().getPartitionId().toString()));
      }
      store.shutdown();
      // verify that the index object was removed from the metrics.
      assertFalse(storeMetrics.indexes.containsKey(store.getReplicaId().getPartitionId().toString()));
    }
    if(store.isInitialized()) {
      store.shutdown();
    }

    assertTrue(tempDir.getAbsolutePath() + " could not be deleted", cleanDirectory(tempDir, true));
    generatedKeys.clear();
    allKeys.clear();
    idsByLogSegment.clear();
    deletedKeys.clear();
    expiredKeys.clear();
    liveKeys.clear();
    ttlUpdatedKeys.clear();
    undeletedKeys.clear();
    deletedAndShouldBeCompactedKeys.clear();
  }
Releases all resources and deletes the temporary directory.
@throws IOException
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java