Search in sources :

Example 1 with ManualTimer

use of io.pravega.segmentstore.server.ManualTimer in project pravega by pravega.

the class WriterStateTests method testBasicFeatures.

/**
 * Tests basic functionality (except Forced Flushes).
 */
@Test
public void testBasicFeatures() {
    val s = new WriterState();
    val timer = new ManualTimer();
    timer.setElapsedMillis(0);
    s.recordIterationStarted(timer);
    timer.setElapsedMillis(1);
    Assert.assertEquals(1, s.getElapsedSinceIterationStart(timer).toMillis());
    Assert.assertEquals(1, s.getIterationId());
    s.setLastTruncatedSequenceNumber(10);
    Assert.assertEquals(10, s.getLastTruncatedSequenceNumber());
    Assert.assertFalse(s.getLastIterationError());
    s.recordIterationError();
    Assert.assertTrue(s.getLastIterationError());
    s.recordIterationStarted(timer);
    Assert.assertFalse(s.getLastIterationError());
    Assert.assertEquals(2, s.getIterationId());
    s.setLastReadSequenceNumber(123);
    Assert.assertEquals(123, s.getLastReadSequenceNumber());
}
Also used : lombok.val(lombok.val) ManualTimer(io.pravega.segmentstore.server.ManualTimer) Test(org.junit.Test)

Aggregations

ManualTimer (io.pravega.segmentstore.server.ManualTimer)1 lombok.val (lombok.val)1 Test (org.junit.Test)1