use of io.eventuate.local.db.log.common.DuplicatePublishingDetector in project eventuate-local by eventuate-local.
the class AbstractDuplicatePublishingDetectorTest method shouldBePublishedTest.
@Test
public void shouldBePublishedTest() {
String topicName = generateUniqueTopicName();
String binlogFilename = "binlog.file." + System.currentTimeMillis();
DuplicatePublishingDetector duplicatePublishingDetector = new DuplicatePublishingDetector(eventuateKafkaConfigurationProperties.getBootstrapServers());
Producer<String, String> producer = createProducer(eventuateKafkaConfigurationProperties.getBootstrapServers());
floodTopic(producer, binlogFilename, topicName);
producer.close();
assertFalse(duplicatePublishingDetector.shouldBePublished(new BinlogFileOffset(binlogFilename, 1L), topicName));
assertTrue(duplicatePublishingDetector.shouldBePublished(new BinlogFileOffset(binlogFilename, 10L), topicName));
}
use of io.eventuate.local.db.log.common.DuplicatePublishingDetector in project eventuate-local by eventuate-local.
the class AbstractDuplicatePublishingDetectorTest method emptyTopicTest.
@Test
public void emptyTopicTest() {
DuplicatePublishingDetector duplicatePublishingDetector = new DuplicatePublishingDetector(eventuateKafkaConfigurationProperties.getBootstrapServers());
BinlogFileOffset bfo = generateBinlogFileOffset();
assertTrue(duplicatePublishingDetector.shouldBePublished(bfo, generateUniqueTopicName()));
}
use of io.eventuate.local.db.log.common.DuplicatePublishingDetector in project eventuate-local by eventuate-local.
the class AbstractDuplicatePublishingDetectorTest method shouldHandlePublishCheckForOldEntires.
@Test
public void shouldHandlePublishCheckForOldEntires() {
String topicName = generateUniqueTopicName();
String binlogFilename = "binlog.file." + System.currentTimeMillis();
DuplicatePublishingDetector duplicatePublishingDetector = new DuplicatePublishingDetector(eventuateKafkaConfigurationProperties.getBootstrapServers());
Producer<String, String> producer = createProducer(eventuateKafkaConfigurationProperties.getBootstrapServers());
floodTopic(producer, binlogFilename, topicName);
sendOldPublishedEvent(producer, topicName);
producer.close();
assertTrue(duplicatePublishingDetector.shouldBePublished(new BinlogFileOffset(binlogFilename, 10L), topicName));
}
Aggregations