Search in sources :

Example 1 with DuplicatePublishingDetector

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));
}
Also used : BinlogFileOffset(io.eventuate.local.common.BinlogFileOffset) DuplicatePublishingDetector(io.eventuate.local.db.log.common.DuplicatePublishingDetector) Test(org.junit.Test) AbstractCdcTest(io.eventuate.local.test.util.AbstractCdcTest)

Example 2 with DuplicatePublishingDetector

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()));
}
Also used : BinlogFileOffset(io.eventuate.local.common.BinlogFileOffset) DuplicatePublishingDetector(io.eventuate.local.db.log.common.DuplicatePublishingDetector) Test(org.junit.Test) AbstractCdcTest(io.eventuate.local.test.util.AbstractCdcTest)

Example 3 with DuplicatePublishingDetector

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));
}
Also used : BinlogFileOffset(io.eventuate.local.common.BinlogFileOffset) DuplicatePublishingDetector(io.eventuate.local.db.log.common.DuplicatePublishingDetector) Test(org.junit.Test) AbstractCdcTest(io.eventuate.local.test.util.AbstractCdcTest)

Aggregations

BinlogFileOffset (io.eventuate.local.common.BinlogFileOffset)3 DuplicatePublishingDetector (io.eventuate.local.db.log.common.DuplicatePublishingDetector)3 AbstractCdcTest (io.eventuate.local.test.util.AbstractCdcTest)3 Test (org.junit.Test)3