Search in sources :

Example 1 with GlobalWatermarkThroughputLimiter

use of cz.o2.proxima.storage.watermark.GlobalWatermarkThroughputLimiter in project proxima-platform by O2-Czech-Republic.

the class DirectDataOperatorTest method testLimiterDataAccessor.

@Test
public void testLimiterDataAccessor() {
    repo.reloadConfig(true, ConfigFactory.load("test-limiter.conf").withFallback(ConfigFactory.load("test-reference.conf")).resolve());
    DirectDataOperator direct = repo.getOrCreateOperator(DirectDataOperator.class);
    DirectAttributeFamilyDescriptor family = direct.getFamilyByName("event-storage-stream");
    Optional<CommitLogReader> maybeReader = family.getCommitLogReader();
    assertTrue(maybeReader.isPresent());
    CommitLogReader reader = maybeReader.get();
    assertTrue("Expected reader of class LimitedCommitLogReader, got " + reader.getClass(), reader instanceof LimitedCommitLogReader);
    LimitedCommitLogReader limitedReader = (LimitedCommitLogReader) reader;
    ThroughputLimiter limiter = limitedReader.getLimiter();
    assertNotNull(limiter);
    assertTrue(limiter instanceof GlobalWatermarkThroughputLimiter);
    GlobalWatermarkThroughputLimiter watermarkLimiter = (GlobalWatermarkThroughputLimiter) limiter;
    GlobalWatermarkTracker tracker = watermarkLimiter.getTracker();
    assertTrue(tracker instanceof TestTracker);
    TestTracker testTracker = (TestTracker) tracker;
    assertEquals(2, testTracker.getTestConf());
}
Also used : GlobalWatermarkThroughputLimiter(cz.o2.proxima.storage.watermark.GlobalWatermarkThroughputLimiter) ThroughputLimiter(cz.o2.proxima.storage.ThroughputLimiter) TestTracker(cz.o2.proxima.storage.watermark.GlobalWatermarkThroughputLimiterTest.TestTracker) LimitedCommitLogReader(cz.o2.proxima.direct.commitlog.CommitLogReaders.LimitedCommitLogReader) CommitLogReader(cz.o2.proxima.direct.commitlog.CommitLogReader) LimitedCommitLogReader(cz.o2.proxima.direct.commitlog.CommitLogReaders.LimitedCommitLogReader) GlobalWatermarkTracker(cz.o2.proxima.storage.watermark.GlobalWatermarkTracker) GlobalWatermarkThroughputLimiter(cz.o2.proxima.storage.watermark.GlobalWatermarkThroughputLimiter) Test(org.junit.Test)

Aggregations

CommitLogReader (cz.o2.proxima.direct.commitlog.CommitLogReader)1 LimitedCommitLogReader (cz.o2.proxima.direct.commitlog.CommitLogReaders.LimitedCommitLogReader)1 ThroughputLimiter (cz.o2.proxima.storage.ThroughputLimiter)1 GlobalWatermarkThroughputLimiter (cz.o2.proxima.storage.watermark.GlobalWatermarkThroughputLimiter)1 TestTracker (cz.o2.proxima.storage.watermark.GlobalWatermarkThroughputLimiterTest.TestTracker)1 GlobalWatermarkTracker (cz.o2.proxima.storage.watermark.GlobalWatermarkTracker)1 Test (org.junit.Test)1