@SuppressWarnings("unchecked") @Test public void liveReload() { Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier = mock(Supplier.class); when(runtimeConfigSupplier.get()) .thenReturn(createRuntimeConfig(TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_UNSET)) .thenReturn(createRuntimeConfig(TARGETED_SWEEP_DISABLED, BACKGROUND_SWEEP_UNSET)) .thenReturn(createRuntimeConfig(TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_ENABLED)); ShouldRunBackgroundSweepSupplier supplier = new ShouldRunBackgroundSweepSupplier( () -> runtimeConfigSupplier.get().sweep(), SWEEP_QUEUE_WRITES_ENABLED.enableSweepQueueWrites()); assertThat(supplier.getAsBoolean()).as("TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_UNSET").isFalse(); assertThat(supplier.getAsBoolean()).as("TARGETED_SWEEP_DISABLED, BACKGROUND_SWEEP_UNSET").isFalse(); assertThat(supplier.getAsBoolean()).as("TARGETED_SWEEP_ENABLED, BACKGROUND_SWEEP_ENABLED").isTrue(); }
@Override public boolean getAsBoolean() { return runtimeConfigSupplier.get().enabled().orElse(!sweepQueueWritesEnabled); }
ShouldRunBackgroundSweepSupplier implements BooleanSupplier { @Override public boolean getAsBoolean() { return runtimeConfigSupplier.get().enabled().orElse(!sweepQueueWritesEnabled); } }
ShouldRunBackgroundSweepSupplier implements BooleanSupplier { @Override public boolean getAsBoolean() { return runtimeConfigSupplier.get().enabled().orElse(!sweepQueueWritesEnabled); } ShouldRunBackgroundSweepSupplier(Supplier<SweepConfig> runtimeConfig, boolean sweepQueueWritesEnabled); }
ShouldRunBackgroundSweepSupplier implements BooleanSupplier { @Override public boolean getAsBoolean() { return runtimeConfigSupplier.get().enabled().orElse(!sweepQueueWritesEnabled); } ShouldRunBackgroundSweepSupplier(Supplier<SweepConfig> runtimeConfig, boolean sweepQueueWritesEnabled); @Override boolean getAsBoolean(); }
ShouldRunBackgroundSweepSupplier implements BooleanSupplier { @Override public boolean getAsBoolean() { return runtimeConfigSupplier.get().enabled().orElse(!sweepQueueWritesEnabled); } ShouldRunBackgroundSweepSupplier(Supplier<SweepConfig> runtimeConfig, boolean sweepQueueWritesEnabled); @Override boolean getAsBoolean();  }