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());
}
Aggregations