RepairManager implements AutoCloseable { public RepairRun updateRepairRunIntensity(RepairRun repairRun, Double intensity) throws ReaperException { RepairRun updatedRun = repairRun.with().intensity(intensity).build(repairRun.getId()); if (!context.storage.updateRepairRun(updatedRun, Optional.of(false))) { throw new ReaperException("failed updating repair run " + updatedRun.getId()); } return updatedRun; } private  RepairManager(
      AppContext context,
      ClusterFacade clusterFacade,
      ScheduledExecutorService executor,
      long repairTimeout,
      TimeUnit repairTimeoutTimeUnit,
      long retryDelay,
      TimeUnit retryDelayTimeUnit); static RepairManager create(
      AppContext context,
      ScheduledExecutorService executor,
      long repairTimeout,
      TimeUnit repairTimeoutTimeUnit,
      long retryDelay,
      TimeUnit retryDelayTimeUnit); void resumeRunningRepairRuns(); RepairSegment abortSegment(UUID runId, UUID segmentId); RepairRun startRepairRun(RepairRun runToBeStarted); RepairRun updateRepairRunIntensity(RepairRun repairRun, Double intensity); RepairRun pauseRepairRun(RepairRun runToBePaused); RepairRun abortRepairRun(RepairRun runToBeAborted); @Override void close();  }
@Test public void updateRepairRunIntensityTest() throws ReaperException, InterruptedException { final String clusterName = "reaper"; AppContext context = new AppContext(); context.config = new ReaperApplicationConfiguration(); context.storage = mock(IStorage.class); context.storage .addCluster(Cluster.builder().withName(clusterName).withSeedHosts(ImmutableSet.of("127.0.0.1")).build()); context.repairManager = RepairManager.create( context, Executors.newScheduledThreadPool(1), 500, TimeUnit.MILLISECONDS, 1, TimeUnit.MILLISECONDS); final String ksName = "reaper"; final Set<String> cfNames = Sets.newHashSet("reaper"); final boolean incrementalRepair = false; final Set<String> nodes = Sets.newHashSet("127.0.0.1"); final Set<String> datacenters = Collections.emptySet(); final int repairThreadCount = 1; final RepairUnit cf = RepairUnit.builder() .clusterName(clusterName) .keyspaceName(ksName) .columnFamilies(cfNames) .incrementalRepair(incrementalRepair) .nodes(nodes) .datacenters(datacenters) .repairThreadCount(repairThreadCount) .build(UUIDs.timeBased()); double intensity = 0.5f; final RepairRun run = RepairRun.builder(clusterName, cf.getId()) .intensity(intensity) .segmentCount(1) .repairParallelism(RepairParallelism.PARALLEL) .tables(TABLES) .build(UUIDs.timeBased()); when(context.storage.updateRepairRun(any(), any())).thenReturn(true); intensity = 0.1; RepairRun updated = context.repairManager.updateRepairRunIntensity(run, intensity); Assertions.assertThat(updated.getId()).isEqualTo(run.getId()); Assertions.assertThat(updated.getIntensity()).isEqualTo(intensity); Mockito.verify(context.storage, Mockito.times(1)).updateRepairRun(any(), any()); }