StorageService.instance.setPartitionerUnsafe(new Murmur3Partitioner());
TokenMetadata metadata = StorageService.instance.getTokenMetadata();
metadata.clearUnsafe();
metadata.updateNormalToken(new LongToken(1000L), InetAddress.getByName("127.0.0.1"));
metadata.updateNormalToken(new LongToken(2000L), InetAddress.getByName("127.0.0.2"));
metadata.updateNormalToken(new LongToken(3000L), InetAddress.getByName("127.0.0.3"));
metadata.updateNormalToken(new LongToken(4000L), InetAddress.getByName("127.0.0.4"));
Map<String, String> configOptions = new HashMap<String, String>();
configOptions.put("replication_factor", "3");
Collection<Range<Token>> repairRangeFrom = StorageService.instance.createRepairRangeFrom("1500", "3700");
assert repairRangeFrom.size() == 3;
assert repairRangeFrom.contains(new Range<Token>(new LongToken(1500L), new LongToken(2000L)));
assert repairRangeFrom.contains(new Range<Token>(new LongToken(2000L), new LongToken(3000L)));
assert repairRangeFrom.contains(new Range<Token>(new LongToken(3000L), new LongToken(3700L)));
repairRangeFrom = StorageService.instance.createRepairRangeFrom("500", "700");
assert repairRangeFrom.size() == 1;
assert repairRangeFrom.contains(new Range<Token>(new LongToken(500L), new LongToken(700L)));
repairRangeFrom = StorageService.instance.createRepairRangeFrom("500", "1700");
assert repairRangeFrom.size() == 2;
assert repairRangeFrom.contains(new Range<Token>(new LongToken(500L), new LongToken(1000L)));
assert repairRangeFrom.contains(new Range<Token>(new LongToken(1000L), new LongToken(1700L)));
repairRangeFrom = StorageService.instance.createRepairRangeFrom("2500", "2300");
assert repairRangeFrom.size() == 5;
assert repairRangeFrom.contains(new Range<Token>(new LongToken(2500L), new LongToken(3000L)));
assert repairRangeFrom.contains(new Range<Token>(new LongToken(3000L), new LongToken(4000L)));
assert repairRangeFrom.contains(new Range<Token>(new LongToken(4000L), new LongToken(1000L)));
assert repairRangeFrom.contains(new Range<Token>(new LongToken(1000L), new LongToken(2000L)));
assert repairRangeFrom.contains(new Range<Token>(new LongToken(2000L), new LongToken(2300L)));
repairRangeFrom = StorageService.instance.createRepairRangeFrom("2000", "3000");
assert repairRangeFrom.size() == 1;
assert repairRangeFrom.contains(new Range<Token>(new LongToken(2000L), new LongToken(3000L)));
repairRangeFrom = StorageService.instance.createRepairRangeFrom("2000", "2000");
assert repairRangeFrom.size() == 0;
}