@Test public void testFullyRepairedPositive() { long repair_end = 10; long repair_start = repair_end - 5; long iterate_start = repair_start - 5; long iterate_end = repair_end + 10; Map<LongTokenRange, Collection<Host>> tokenToHostMap = new HashMap<>(); Metadata metadata = mySession.getCluster().getMetadata(); Set<Host> hosts = metadata.getAllHosts(); Host host = hosts.iterator().next(); List<RepairEntry> expectedRepairEntries = new ArrayList<>(); expectedRepairEntries.add(new RepairEntry(new LongTokenRange(0, 1), repair_start, Sets.newHashSet(host.getAddress()), "SUCCESS")); expectedRepairEntries.add(new RepairEntry(new LongTokenRange(2, 3), repair_start + 1, Sets.newHashSet(host.getAddress()), "SUCCESS")); expectedRepairEntries.add(new RepairEntry(new LongTokenRange(4, 5), repair_start + 2, Sets.newHashSet(host.getAddress()), "SUCCESS")); for (RepairEntry repairEntry : expectedRepairEntries) { insertRecord(KEYSPACE, TABLE, repairEntry); } tokenToHostMap.put(new LongTokenRange(0, 1), Sets.newHashSet(hosts)); tokenToHostMap.put(new LongTokenRange(2, 3), Sets.newHashSet(hosts)); tokenToHostMap.put(new LongTokenRange(4, 5), Sets.newHashSet(hosts)); Iterator<RepairEntry> repairEntryIterator = repairHistoryProvider.iterate(myTableReference, iterate_end, iterate_start, new FullyRepairedRepairEntryPredicate(tokenToHostMap)); List<RepairEntry> actualRepairEntries = Lists.newArrayList(repairEntryIterator); assertThat(actualRepairEntries).containsExactlyElementsOf(expectedRepairEntries); }
@Override public Iterator<RepairEntry> iterate(TableReference tableReference, long to, Predicate<RepairEntry> predicate) { long from = myClock.millis() - myLookbackTime; return iterate(tableReference, to, from, predicate); }
RepairHistoryProviderImpl implements RepairHistoryProvider { @Override public Iterator<RepairEntry> iterate(TableReference tableReference, long to, Predicate<RepairEntry> predicate) { long from = myClock.millis() - myLookbackTime; return iterate(tableReference, to, from, predicate); } }
RepairHistoryProviderImpl implements RepairHistoryProvider { @Override public Iterator<RepairEntry> iterate(TableReference tableReference, long to, Predicate<RepairEntry> predicate) { long from = myClock.millis() - myLookbackTime; return iterate(tableReference, to, from, predicate); } RepairHistoryProviderImpl(Session session, StatementDecorator statementDecorator, long lookbackTime); @VisibleForTesting  RepairHistoryProviderImpl(Session session, StatementDecorator statementDecorator, long lookbackTime, Clock clock); }
RepairHistoryProviderImpl implements RepairHistoryProvider { @Override public Iterator<RepairEntry> iterate(TableReference tableReference, long to, Predicate<RepairEntry> predicate) { long from = myClock.millis() - myLookbackTime; return iterate(tableReference, to, from, predicate); } RepairHistoryProviderImpl(Session session, StatementDecorator statementDecorator, long lookbackTime); @VisibleForTesting  RepairHistoryProviderImpl(Session session, StatementDecorator statementDecorator, long lookbackTime, Clock clock); @Override Iterator<RepairEntry> iterate(TableReference tableReference, long to, Predicate<RepairEntry> predicate); @Override Iterator<RepairEntry> iterate(TableReference tableReference, long to, long from, Predicate<RepairEntry> predicate); }
RepairHistoryProviderImpl implements RepairHistoryProvider { @Override public Iterator<RepairEntry> iterate(TableReference tableReference, long to, Predicate<RepairEntry> predicate) { long from = myClock.millis() - myLookbackTime; return iterate(tableReference, to, from, predicate); } RepairHistoryProviderImpl(Session session, StatementDecorator statementDecorator, long lookbackTime); @VisibleForTesting  RepairHistoryProviderImpl(Session session, StatementDecorator statementDecorator, long lookbackTime, Clock clock); @Override Iterator<RepairEntry> iterate(TableReference tableReference, long to, Predicate<RepairEntry> predicate); @Override Iterator<RepairEntry> iterate(TableReference tableReference, long to, long from, Predicate<RepairEntry> predicate);  }