test_class.declarator: TWO_HOURS_AGO = DateTime.now().minusHours(2)
test_class.modifier: private static final
test_class.original_string: private static final DateTime TWO_HOURS_AGO = DateTime.now().minusHours(2);
test_class.type: DateTime
test_class.var_name: TWO_HOURS_AGO
test_class.declarator: DELAY_BEFORE_SCHEDULE = Duration.ofMinutes(4)
test_class.modifier: private static final
test_class.original_string: private static final Duration DELAY_BEFORE_SCHEDULE = Duration.ofMinutes(4);
test_class.type: Duration
test_class.var_name: DELAY_BEFORE_SCHEDULE
test_class.declarator: STCS = "SizeTieredCompactionStrategy"
test_class.modifier: private static final
test_class.original_string: private static final String STCS = "SizeTieredCompactionStrategy";
test_class.type: String
test_class.var_name: STCS
test_class.declarator: cluster
test_class.modifier: private
test_class.original_string: private Cluster cluster;
test_class.type: Cluster
test_class.var_name: cluster
test_class.declarator: context
test_class.modifier: private
test_class.original_string: private AppContext context;
test_class.type: AppContext
test_class.var_name: context
test_class.declarator: clusterRepairAuto
test_class.modifier: private
test_class.original_string: private ClusterRepairScheduler clusterRepairAuto;
test_class.type: ClusterRepairScheduler
test_class.var_name: clusterRepairAuto
test_class.declarator: jmxProxy
test_class.modifier: private
test_class.original_string: private JmxProxy jmxProxy;
test_class.type: JmxProxy
test_class.var_name: jmxProxy
test_class.file: src/server/src/test/java/io/cassandrareaper/service/ClusterRepairSchedulerTest.java
test_class.identifier: ClusterRepairSchedulerTest
test_case.body: @Test
    public void schedulesRepairForAllKeyspacesInAllClusters() throws Exception {
      // https://github.com/thelastpickle/cassandra-reaper/issues/298
      context.config.getAutoScheduling().setExcludedKeyspaces(null);
  
      context.storage.addCluster(cluster);
      when(jmxProxy.getKeyspaces()).thenReturn(Lists.newArrayList("keyspace1", "keyspace3"));
  
      when(jmxProxy.getTablesForKeyspace("keyspace1")).thenReturn(
              Sets.newHashSet(Table.builder().withName("table1").withCompactionStrategy(STCS).build()));
  
      when(jmxProxy.getTablesForKeyspace("keyspace3")).thenReturn(
              Sets.newHashSet(Table.builder().withName("table1").withCompactionStrategy(STCS).build()));
  
      clusterRepairAuto.scheduleRepairs(cluster);
      assertThat(context.storage.getAllRepairSchedules()).hasSize(2);
  
      assertThatClusterRepairSchedules(context.storage.getRepairSchedulesForCluster(cluster.getName()))
          .hasScheduleCount(2)
          .repairScheduleForKeyspace("keyspace1")
          .hasSameConfigItemsAs(context.config)
          .hasOwner("auto-scheduling")
          .hasNextActivationDateCloseTo(timeOfFirstSchedule())
          .andThen()
          .repairScheduleForKeyspace("keyspace3")
          .hasSameConfigItemsAs(context.config)
          .hasOwner("auto-scheduling")
          .hasNextActivationDateCloseTo(timeOfFirstSchedule());
    }
test_case.class_method_signature: ClusterRepairSchedulerTest.schedulesRepairForAllKeyspacesInAllClusters()
test_case.full_signature: @Test public void schedulesRepairForAllKeyspacesInAllClusters()
test_case.identifier: schedulesRepairForAllKeyspacesInAllClusters
test_case.invocations: setExcludedKeyspaces getAutoScheduling addCluster thenReturn when getKeyspaces newArrayList thenReturn when getTablesForKeyspace newHashSet build withCompactionStrategy withName builder thenReturn when getTablesForKeyspace newHashSet build withCompactionStrategy withName builder scheduleRepairs hasSize assertThat getAllRepairSchedules hasNextActivationDateCloseTo hasOwner hasSameConfigItemsAs repairScheduleForKeyspace andThen hasNextActivationDateCloseTo hasOwner hasSameConfigItemsAs repairScheduleForKeyspace hasScheduleCount assertThatClusterRepairSchedules getRepairSchedulesForCluster getName timeOfFirstSchedule timeOfFirstSchedule
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void schedulesRepairForAllKeyspacesInAllClusters()
focal_class.declarator: LOG = LoggerFactory.getLogger(ClusterRepairScheduler.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(ClusterRepairScheduler.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: REPAIR_OWNER = "auto-scheduling"
focal_class.modifier: private static final
focal_class.original_string: private static final String REPAIR_OWNER = "auto-scheduling";
focal_class.type: String
focal_class.var_name: REPAIR_OWNER
focal_class.declarator: SYSTEM_KEYSPACE_PREFIX = "system"
focal_class.modifier: private static final
focal_class.original_string: private static final String SYSTEM_KEYSPACE_PREFIX = "system";
focal_class.type: String
focal_class.var_name: SYSTEM_KEYSPACE_PREFIX
focal_class.declarator: context
focal_class.modifier: private final
focal_class.original_string: private final AppContext context;
focal_class.type: AppContext
focal_class.var_name: context
focal_class.declarator: repairUnitService
focal_class.modifier: private final
focal_class.original_string: private final RepairUnitService repairUnitService;
focal_class.type: RepairUnitService
focal_class.var_name: repairUnitService
focal_class.declarator: repairScheduleService
focal_class.modifier: private final
focal_class.original_string: private final RepairScheduleService repairScheduleService;
focal_class.type: RepairScheduleService
focal_class.var_name: repairScheduleService
focal_class.file: src/server/src/main/java/io/cassandrareaper/service/ClusterRepairScheduler.java
focal_class.identifier: ClusterRepairScheduler
focal_class.class_method_signature: ClusterRepairScheduler.ClusterRepairScheduler(AppContext context)
focal_class.full_signature: public  ClusterRepairScheduler(AppContext context)
focal_class.identifier: ClusterRepairScheduler
focal_class.modifiers: public
focal_class.parameters: (AppContext context)
focal_class.signature:  ClusterRepairScheduler(AppContext context)
focal_class.class_method_signature: ClusterRepairScheduler.scheduleRepairs(Cluster cluster)
focal_class.full_signature: public void scheduleRepairs(Cluster cluster)
focal_class.identifier: scheduleRepairs
focal_class.modifiers: public
focal_class.parameters: (Cluster cluster)
focal_class.return: void
focal_class.signature: void scheduleRepairs(Cluster cluster)
focal_class.class_method_signature: ClusterRepairScheduler.nextActivationStartDate(int scheduleIndex)
focal_class.full_signature: private DateTime nextActivationStartDate(int scheduleIndex)
focal_class.identifier: nextActivationStartDate
focal_class.modifiers: private
focal_class.parameters: (int scheduleIndex)
focal_class.return: DateTime
focal_class.signature: DateTime nextActivationStartDate(int scheduleIndex)
focal_class.class_method_signature: ClusterRepairScheduler.deleteRepairSchedule(Cluster cluster, String keyspace)
focal_class.full_signature: private void deleteRepairSchedule(Cluster cluster, String keyspace)
focal_class.identifier: deleteRepairSchedule
focal_class.modifiers: private
focal_class.parameters: (Cluster cluster, String keyspace)
focal_class.return: void
focal_class.signature: void deleteRepairSchedule(Cluster cluster, String keyspace)
focal_class.class_method_signature: ClusterRepairScheduler.keyspaceCandidateForRepair(Cluster cluster, String keyspace)
focal_class.full_signature: private boolean keyspaceCandidateForRepair(Cluster cluster, String keyspace)
focal_class.identifier: keyspaceCandidateForRepair
focal_class.modifiers: private
focal_class.parameters: (Cluster cluster, String keyspace)
focal_class.return: boolean
focal_class.signature: boolean keyspaceCandidateForRepair(Cluster cluster, String keyspace)
focal_class.class_method_signature: ClusterRepairScheduler.createRepairSchedule(Cluster cluster, String keyspace, DateTime nextActivationTime)
focal_class.full_signature: private void createRepairSchedule(Cluster cluster, String keyspace, DateTime nextActivationTime)
focal_class.identifier: createRepairSchedule
focal_class.modifiers: private
focal_class.parameters: (Cluster cluster, String keyspace, DateTime nextActivationTime)
focal_class.return: void
focal_class.signature: void createRepairSchedule(Cluster cluster, String keyspace, DateTime nextActivationTime)
focal_class.class_method_signature: ClusterRepairScheduler.keyspaceHasNoTable(AppContext context, Cluster cluster, String keyspace)
focal_class.full_signature: private boolean keyspaceHasNoTable(AppContext context, Cluster cluster, String keyspace)
focal_class.identifier: keyspaceHasNoTable
focal_class.modifiers: private
focal_class.parameters: (AppContext context, Cluster cluster, String keyspace)
focal_class.return: boolean
focal_class.signature: boolean keyspaceHasNoTable(AppContext context, Cluster cluster, String keyspace)
focal_method.body: public void scheduleRepairs(Cluster cluster) throws ReaperException {
      List<String> excludedClusters = context
          .config
          .getAutoScheduling()
          .getExcludedClusters()
          .stream()
          .map(Cluster::toSymbolicName)
          .collect(Collectors.toList());
      if (excludedClusters.contains(cluster.getName())) {
        LOG.debug("Not creating schedules for excluded cluster {}.", cluster.getName());
        return;
      }
      AtomicInteger scheduleIndex = new AtomicInteger();
      ScheduledRepairDiffView schedulesDiff = ScheduledRepairDiffView.compareWithExistingSchedules(context, cluster);
      schedulesDiff.keyspacesDeleted().forEach(keyspace -> deleteRepairSchedule(cluster, keyspace));
      schedulesDiff
          .keyspacesWithoutSchedules()
          .stream()
          .filter(keyspace -> keyspaceCandidateForRepair(cluster, keyspace))
          .forEach(
              keyspace
                -> createRepairSchedule(cluster, keyspace, nextActivationStartDate(scheduleIndex.getAndIncrement())));
    }
focal_method.class_method_signature: ClusterRepairScheduler.scheduleRepairs(Cluster cluster)
focal_method.full_signature: public void scheduleRepairs(Cluster cluster)
focal_method.identifier: scheduleRepairs
focal_method.invocations: collect map stream getExcludedClusters getAutoScheduling toList contains getName debug getName compareWithExistingSchedules forEach keyspacesDeleted deleteRepairSchedule forEach filter stream keyspacesWithoutSchedules keyspaceCandidateForRepair createRepairSchedule nextActivationStartDate getAndIncrement
focal_method.modifiers: public
focal_method.parameters: (Cluster cluster)
focal_method.return: void
focal_method.signature: void scheduleRepairs(Cluster cluster)