use of org.wikidata.query.rdf.tool.wikibase.WikibaseApiError in project wikidata-query-rdf by wikimedia.
the class RecentChangesPollerUnitTest method delete.
/**
* Check that delete is processed.
* @throws RetryableException
*/
@Test
@SuppressWarnings("unchecked")
public void delete() throws RetryableException {
// Use old date to remove backoff
Instant startTime = Instant.now().minus(10, ChronoUnit.DAYS);
// Build a result from wikibase with duplicate recent changes
WikibaseApiError error = null;
Continue aContinue = null;
List<RecentChange> recentChanges = new ArrayList<>();
recentChanges.add(new RecentChange(0L, "Q424242", Instant.now(), 0L, 42L, "log"));
recentChanges.add(new RecentChange(0L, "Q424242", Instant.now(), 7L, 45L, "edit"));
Query query = new Query(recentChanges);
RecentChangeResponse result = new RecentChangeResponse(error, aContinue, query);
firstBatchReturns(startTime, result);
RecentChangesPoller poller = new RecentChangesPoller(repository, startTime, batchSize, new MetricRegistry());
Batch batch = poller.firstBatch();
List<Change> changes = batch.changes();
assertThat(changes).hasSize(1);
assertThat(changes.get(0).entityId()).isEqualTo("Q424242");
assertThat(changes.get(0).offset()).isEqualTo(42L);
assertThat(changes.get(0).revision()).isEqualTo(-1L);
}
Aggregations