RepairRunService { @VisibleForTesting static Map<String, List<RingRange>> buildEndpointToRangeMap(Map<List<String>, List<String>> rangeToEndpoint) { Map<String, List<RingRange>> endpointToRange = Maps.newHashMap(); for (Entry<List<String>, List<String>> entry : rangeToEndpoint.entrySet()) { RingRange range = new RingRange(entry.getKey().toArray(new String[entry.getKey().size()])); for (String endpoint : entry.getValue()) { List<RingRange> ranges = endpointToRange.getOrDefault(endpoint, Lists.newArrayList()); ranges.add(range); endpointToRange.put(endpoint, ranges); } } return endpointToRange; } private  RepairRunService(AppContext context); static RepairRunService create(AppContext context); RepairRun registerRepairRun(
      Cluster cluster,
      RepairUnit repairUnit,
      Optional<String> cause,
      String owner,
      int segments,
      int segmentsPerNode,
      RepairParallelism repairParallelism,
      Double intensity); Set<String> getTableNamesBasedOnParam(
      Cluster cluster,
      String keyspace,
      Optional<String> tableNamesParam); Set<String> getNodesToRepairBasedOnParam(
      Cluster cluster,
      Optional<String> nodesToRepairParam); static Set<String> getDatacentersToRepairBasedOnParam(Cluster cluster, Optional<String> datacenters); static final Splitter COMMA_SEPARATED_LIST_SPLITTER; static final int DEFAULT_SEGMENT_COUNT_PER_NODE; }
@Test public void buildEndpointToRangeMapTest() { Map<List<String>, List<String>> rangeToEndpoint = Maps.newHashMap(); rangeToEndpoint.put(Arrays.asList("1", "2"), Arrays.asList("node1", "node2", "node3")); rangeToEndpoint.put(Arrays.asList("2", "4"), Arrays.asList("node1", "node2", "node3")); rangeToEndpoint.put(Arrays.asList("4", "6"), Arrays.asList("node1")); rangeToEndpoint.put(Arrays.asList("6", "8"), Arrays.asList("node1", "node2")); Map<String, List<RingRange>> endpointToRangeMap = RepairRunService.buildEndpointToRangeMap(rangeToEndpoint); assertEquals(endpointToRangeMap.entrySet().size(), 3); assertEquals(endpointToRangeMap.get("node1").size(), 4); assertEquals(endpointToRangeMap.get("node2").size(), 3); assertEquals(endpointToRangeMap.get("node3").size(), 2); }