@Test public void testGetRepairTask() { Host host = mockHost("DC1"); LongTokenRange range = new LongTokenRange(1, 2); ImmutableSet<Host> hosts = ImmutableSet.of(host); Set<LongTokenRange> ranges = new HashSet<>(); ranges.add(range); ReplicaRepairGroup replicaRepairGroup = new ReplicaRepairGroup(hosts, ImmutableList.of(range)); RepairGroup repairGroup = new RepairGroup(priority, tableReference, repairConfiguration, replicaRepairGroup, myJmxProxyFactory, myTableRepairMetrics, myRepairResourceFactory, myRepairLockFactory); Collection<RepairTask> repairTasks = repairGroup.getRepairTasks(); assertThat((repairTasks).isEmpty()).isFalse(); RepairTask repairTask = repairTasks.iterator().next(); assertThat(repairTask.getReplicas()).isEqualTo(hosts); assertThat(repairTask.getTokenRanges()).isEqualTo(ranges); assertThat(repairTask.getTableReference()).isEqualTo(tableReference); assertThat(repairTask.getRepairConfiguration().getRepairParallelism()).isEqualTo(RepairOptions.RepairParallelism.PARALLEL); }
@VisibleForTesting Collection<RepairTask> getRepairTasks() { Collection<RepairTask> tasks = new ArrayList<>(); RepairTask.Builder builder = new RepairTask.Builder() .withJMXProxyFactory(myJmxProxyFactory) .withTableReference(myTableReference) .withTableRepairMetrics(myTableRepairMetrics) .withRepairConfiguration(myRepairConfiguration) .withReplicas(myReplicaRepairGroup.getReplicas()); for (LongTokenRange range : myReplicaRepairGroup) { builder.withTokenRanges(Collections.singletonList(range)); tasks.add(builder.build()); } return tasks; }
RepairGroup extends ScheduledTask { @VisibleForTesting Collection<RepairTask> getRepairTasks() { Collection<RepairTask> tasks = new ArrayList<>(); RepairTask.Builder builder = new RepairTask.Builder() .withJMXProxyFactory(myJmxProxyFactory) .withTableReference(myTableReference) .withTableRepairMetrics(myTableRepairMetrics) .withRepairConfiguration(myRepairConfiguration) .withReplicas(myReplicaRepairGroup.getReplicas()); for (LongTokenRange range : myReplicaRepairGroup) { builder.withTokenRanges(Collections.singletonList(range)); tasks.add(builder.build()); } return tasks; } }
RepairGroup extends ScheduledTask { @VisibleForTesting Collection<RepairTask> getRepairTasks() { Collection<RepairTask> tasks = new ArrayList<>(); RepairTask.Builder builder = new RepairTask.Builder() .withJMXProxyFactory(myJmxProxyFactory) .withTableReference(myTableReference) .withTableRepairMetrics(myTableRepairMetrics) .withRepairConfiguration(myRepairConfiguration) .withReplicas(myReplicaRepairGroup.getReplicas()); for (LongTokenRange range : myReplicaRepairGroup) { builder.withTokenRanges(Collections.singletonList(range)); tasks.add(builder.build()); } return tasks; } RepairGroup(int priority,
                       TableReference tableReference,
                       RepairConfiguration repairConfiguration,
                       ReplicaRepairGroup replicaRepairGroup,
                       JmxProxyFactory jmxProxyFactory,
                       TableRepairMetrics tableRepairMetrics,
                       RepairResourceFactory repairResourceFactory,
                       RepairLockFactory repairLockFactory);  RepairGroup(int priority,
            TableReference tableReference,
            RepairConfiguration repairConfiguration,
            ReplicaRepairGroup replicaRepairGroup,
            JmxProxyFactory jmxProxyFactory,
            TableRepairMetrics tableRepairMetrics,
            RepairResourceFactory repairResourceFactory,
            RepairLockFactory repairLockFactory,
            List<TableRepairPolicy> tableRepairPolicies); }
RepairGroup extends ScheduledTask { @VisibleForTesting Collection<RepairTask> getRepairTasks() { Collection<RepairTask> tasks = new ArrayList<>(); RepairTask.Builder builder = new RepairTask.Builder() .withJMXProxyFactory(myJmxProxyFactory) .withTableReference(myTableReference) .withTableRepairMetrics(myTableRepairMetrics) .withRepairConfiguration(myRepairConfiguration) .withReplicas(myReplicaRepairGroup.getReplicas()); for (LongTokenRange range : myReplicaRepairGroup) { builder.withTokenRanges(Collections.singletonList(range)); tasks.add(builder.build()); } return tasks; } RepairGroup(int priority,
                       TableReference tableReference,
                       RepairConfiguration repairConfiguration,
                       ReplicaRepairGroup replicaRepairGroup,
                       JmxProxyFactory jmxProxyFactory,
                       TableRepairMetrics tableRepairMetrics,
                       RepairResourceFactory repairResourceFactory,
                       RepairLockFactory repairLockFactory);  RepairGroup(int priority,
            TableReference tableReference,
            RepairConfiguration repairConfiguration,
            ReplicaRepairGroup replicaRepairGroup,
            JmxProxyFactory jmxProxyFactory,
            TableRepairMetrics tableRepairMetrics,
            RepairResourceFactory repairResourceFactory,
            RepairLockFactory repairLockFactory,
            List<TableRepairPolicy> tableRepairPolicies); @Override boolean execute(); @Override LockFactory.DistributedLock getLock(LockFactory lockFactory); @Override String toString(); }
RepairGroup extends ScheduledTask { @VisibleForTesting Collection<RepairTask> getRepairTasks() { Collection<RepairTask> tasks = new ArrayList<>(); RepairTask.Builder builder = new RepairTask.Builder() .withJMXProxyFactory(myJmxProxyFactory) .withTableReference(myTableReference) .withTableRepairMetrics(myTableRepairMetrics) .withRepairConfiguration(myRepairConfiguration) .withReplicas(myReplicaRepairGroup.getReplicas()); for (LongTokenRange range : myReplicaRepairGroup) { builder.withTokenRanges(Collections.singletonList(range)); tasks.add(builder.build()); } return tasks; } RepairGroup(int priority,
                       TableReference tableReference,
                       RepairConfiguration repairConfiguration,
                       ReplicaRepairGroup replicaRepairGroup,
                       JmxProxyFactory jmxProxyFactory,
                       TableRepairMetrics tableRepairMetrics,
                       RepairResourceFactory repairResourceFactory,
                       RepairLockFactory repairLockFactory);  RepairGroup(int priority,
            TableReference tableReference,
            RepairConfiguration repairConfiguration,
            ReplicaRepairGroup replicaRepairGroup,
            JmxProxyFactory jmxProxyFactory,
            TableRepairMetrics tableRepairMetrics,
            RepairResourceFactory repairResourceFactory,
            RepairLockFactory repairLockFactory,
            List<TableRepairPolicy> tableRepairPolicies); @Override boolean execute(); @Override LockFactory.DistributedLock getLock(LockFactory lockFactory); @Override String toString();  }