+ @Test
+ public void testGetNextAfterSeekingOnRank_1() {
+ final long INITIAL_RANK = 0L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fTrace.seekEvent(INITIAL_RANK);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+ }
+
+ @Test
+ public void testGetNextAfterSeekingOnRank_2() {
+ final long INITIAL_RANK = 1L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fTrace.seekEvent(INITIAL_RANK);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+ }
+
+ @Test
+ public void testGetNextAfterSeekingOnRank_3() {
+ final long INITIAL_RANK = 500L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fTrace.seekEvent(INITIAL_RANK);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+ }
+
+ @Test
+ public void testGetNextAfterSeekingOnLocation_1() {
+ final ITmfLocation INITIAL_LOC = null;
+ final long INITIAL_TS = 1;