@Test public void testFullyRepairedNegative() throws UnknownHostException { long repair_end = CLOCK_TIME - 5000; long repair_start = repair_end - 5; long iterate_start = repair_start - 5; long iterate_end = CLOCK_TIME; insertRecord(KEYSPACE, TABLE, Sets.newHashSet(InetAddress.getByName("198.162.0.1")), new LongTokenRange(0, 1), repair_start, repair_end, RepairStatus.SUCCESS); insertRecord(KEYSPACE, TABLE, Sets.newHashSet(InetAddress.getByName("198.162.0.2")), new LongTokenRange(2, 3), repair_start, repair_end, RepairStatus.SUCCESS); insertRecord(KEYSPACE, TABLE, Sets.newHashSet(InetAddress.getByName("198.162.0.3")), new LongTokenRange(4, 5), repair_start, repair_end, RepairStatus.SUCCESS); Map<LongTokenRange, Collection<Host>> tokenToHostMap = new HashMap<>(); Metadata metadata = mySession.getCluster().getMetadata(); Set<Host> hosts = metadata.getAllHosts(); 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)); assertThat(repairEntryIterator.hasNext()).isFalse(); }
@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);  }