use of org.wikidata.query.rdf.tool.change.events.ChangeEvent in project wikidata-query-rdf by wikimedia.
the class KafkaPollerUnitTest method deleteRevision.
@Test
public void deleteRevision() throws RetryableException {
ConsumerRecords<String, ChangeEvent> rs = makeRecords(makeRecord(makeRCEvent(Duration.ofMillis(20), 1, 1, "Q123"), "topictest", Duration.ofMillis(20)), makeRecord(makeDeleteEvent(Duration.ofMillis(21), 1, "Q123"), "othertopic", Duration.ofMillis(21)), makeRecord(makeRCEvent(Duration.ofMillis(22), 1, 2, "Q123"), "topictest", Duration.ofMillis(22)));
Batch batch = getBatchFromRecords(rs);
// Delete revision should always win
assertThat(batch.changes()).hasSize(1).anyMatch(revision(-1));
}
use of org.wikidata.query.rdf.tool.change.events.ChangeEvent in project wikidata-query-rdf by wikimedia.
the class KafkaPollerUnitTest method changesFromTopics.
@Test
public void changesFromTopics() throws RetryableException {
ConsumerRecords<String, ChangeEvent> rs = makeRecords(makeRecord(makeRCEvent(Duration.ofMillis(20), 1, 1, "Q123"), "topictest", Duration.ofMillis(20)), makeRecord(makeRCEvent(Duration.ofMillis(21), 2, 1, "Q234"), "othertopic", Duration.ofMillis(21)), makeRecord(makeRCEvent(Duration.ofMillis(20), 3, 1, "Q567"), "topictest", Duration.ofMillis(20)));
Batch batch = getBatchFromRecords(rs);
assertThat(batch.changes()).hasSize(3).anyMatch(title("Q123")).anyMatch(title("Q234")).anyMatch(title("Q567"));
}
Aggregations