@Test
  public void testAddBlobStore() throws StoreException {
    StoreMetrics storeMetrics = new StoreMetrics(new MetricRegistry());
    BlobStore newAddedStore = new MockBlobStore(config, storeMetrics, time, null);
    // without compaction enabled.
    compactionManager.enable();
    compactionManager.addBlobStore(newAddedStore);
    // verify new store is correctly added into compaction manager
    assertTrue("New store is not found in compaction manager",
        compactionManager.getAllStores().contains(newAddedStore));
    compactionManager.disable();
    compactionManager.awaitTermination();
    // with compaction enabled.
    properties.setProperty("store.compaction.triggers", ALL_COMPACTION_TRIGGERS);
    config = new StoreConfig(new VerifiableProperties(properties));
    StorageManagerMetrics metrics = new StorageManagerMetrics(new MetricRegistry());
    compactionManager = new CompactionManager(MOUNT_PATH, config, Collections.singleton(blobStore), metrics, time);
    compactionManager.enable();
    compactionManager.addBlobStore(newAddedStore);
    assertTrue("New store is not found in compaction manager",
        compactionManager.getAllStores().contains(newAddedStore));
    assertFalse("BlobStore should not be scheduled for the new added store before it is started",
        compactionManager.scheduleNextForCompaction(newAddedStore));
    compactionManager.disable();
    compactionManager.awaitTermination();
  }
Tests for adding new BlobStore with/without compaction enabled.
ambry-store/src/test/java/com/github/ambry/store/CompactionManagerTest.java