@Test public void testDifferentTriggers() { blobStore.details = generateRandomCompactionDetails(2); Runnable adminDisabledChecker = () -> assertFalse("Compaction should not be scheduled", compactionManager.scheduleNextForCompaction(blobStore)); properties.setProperty("store.compaction.triggers", ""); AtomicLong startTimeMs = new AtomicLong(time.milliseconds()); Runnable periodicDisabledChecker = () -> assertEquals("Time should not have moved forward", startTimeMs.get(), time.milliseconds()); doTestTrigger(Arrays.asList(adminDisabledChecker, periodicDisabledChecker)); properties.setProperty("store.compaction.triggers", "Periodic"); Runnable periodicEnabledChecker = () -> { try { assertTrue("Compaction calls did not come within the expected time", blobStore.compactCallsCountdown.await(1, TimeUnit.SECONDS)); } catch (InterruptedException e) { throw new IllegalStateException(e); } if (blobStore.callOrderException != null) { throw new IllegalStateException(blobStore.callOrderException); } assertTrue("compact() should have been called", blobStore.compactCalled); }; doTestTrigger(Arrays.asList(adminDisabledChecker, periodicEnabledChecker)); properties.setProperty("store.compaction.triggers", "Admin"); startTimeMs.set(time.milliseconds()); Runnable adminEnabledChecker = () -> { assertTrue("Compaction should be scheduled", compactionManager.scheduleNextForCompaction(blobStore)); try { assertTrue("Compaction calls did not come within the expected time", blobStore.compactCallsCountdown.await(1, TimeUnit.SECONDS)); } catch (InterruptedException e) { throw new IllegalStateException(e); } if (blobStore.callOrderException != null) { throw new IllegalStateException(blobStore.callOrderException); } assertTrue("compact() should have been called", blobStore.compactCalled); }; periodicDisabledChecker = () -> assertEquals("Time should not have moved forward", startTimeMs.get(), time.milliseconds()); doTestTrigger(Arrays.asList(adminEnabledChecker, periodicDisabledChecker)); }
boolean scheduleNextForCompaction(BlobStore store) { return compactionExecutor != null && compactionExecutor.scheduleNextForCompaction(store); }
CompactionManager { boolean scheduleNextForCompaction(BlobStore store) { return compactionExecutor != null && compactionExecutor.scheduleNextForCompaction(store); } }
CompactionManager { boolean scheduleNextForCompaction(BlobStore store) { return compactionExecutor != null && compactionExecutor.scheduleNextForCompaction(store); } CompactionManager(String mountPath, StoreConfig storeConfig, Collection<BlobStore> stores,
      StorageManagerMetrics metrics, Time time); }
CompactionManager { boolean scheduleNextForCompaction(BlobStore store) { return compactionExecutor != null && compactionExecutor.scheduleNextForCompaction(store); } CompactionManager(String mountPath, StoreConfig storeConfig, Collection<BlobStore> stores,
      StorageManagerMetrics metrics, Time time);  }
CompactionManager { boolean scheduleNextForCompaction(BlobStore store) { return compactionExecutor != null && compactionExecutor.scheduleNextForCompaction(store); } CompactionManager(String mountPath, StoreConfig storeConfig, Collection<BlobStore> stores,
      StorageManagerMetrics metrics, Time time);   }