Make the TmfLocation final and get rid of clone()
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core.tests / src / org / eclipse / linuxtools / tmf / core / tests / trace / TmfTraceTest.java
index f1c4e43998b4dc57c22c39f49078a308c0022b0b..143dc5ff3fc4e0305de66a0b2edb3280812829e3 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2010, 20112 Ericsson
+ * Copyright (c) 2009, 2010, 2012 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -14,7 +14,6 @@
 package org.eclipse.linuxtools.tmf.core.tests.trace;
 
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -24,28 +23,28 @@ import junit.framework.TestCase;
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.tmf.core.component.TmfProviderManager;
 import org.eclipse.linuxtools.tmf.core.component.ITmfDataProvider;
-import org.eclipse.linuxtools.tmf.core.component.TmfProviderManager;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
 import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer;
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
 import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
 
 /**
- * <b><u>TmfTraceTest</u></b>
- * <p>
  * Test suite for the TmfTrace class.
  */
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
 public class TmfTraceTest extends TestCase {
 
     // ------------------------------------------------------------------------
@@ -64,7 +63,10 @@ public class TmfTraceTest extends TestCase {
     // Housekeeping
     // ------------------------------------------------------------------------
 
-    public TmfTraceTest(final String name) throws Exception {
+    /**
+     * @param name the test name
+     */
+    public TmfTraceTest(final String name) {
         super(name);
     }
 
@@ -85,13 +87,15 @@ public class TmfTraceTest extends TestCase {
     // Helper functions
     // ------------------------------------------------------------------------
 
-    private TmfTraceStub setupTrace(final String path) {
+    private static TmfTraceStub setupTrace(final String path) {
         if (fTrace == null) {
             try {
                 final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
                 final File test = new File(FileLocator.toFileURL(location).toURI());
                 fTrace = new TmfTraceStub(test.toURI().getPath(), BLOCK_SIZE);
                 fTrace.indexTrace();
+            } catch (final TmfTraceException e) {
+                e.printStackTrace();
             } catch (final URISyntaxException e) {
                 e.printStackTrace();
             } catch (final IOException e) {
@@ -105,7 +109,8 @@ public class TmfTraceTest extends TestCase {
     // Constructors
     // ------------------------------------------------------------------------
 
-    public void testStandardConstructor() throws Exception {
+    @SuppressWarnings("null")
+    public void testStandardConstructor() throws TmfTraceException {
         TmfTraceStub trace = null;
         File testfile = null;
         try {
@@ -123,7 +128,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("getType",  TmfEvent.class, trace.getType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
-        assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
+        assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
         assertEquals("getName", TEST_STREAM, trace.getName());
 
@@ -134,7 +139,8 @@ public class TmfTraceTest extends TestCase {
         assertEquals("getEndTime",     NB_EVENTS, trace.getEndTime().getValue());
     }
 
-    public void testStandardConstructorCacheSize() throws Exception {
+    @SuppressWarnings("null")
+    public void testStandardConstructorCacheSize() throws TmfTraceException {
         TmfTraceStub trace = null;
         File testfile = null;
         try {
@@ -152,7 +158,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("getType",  TmfEvent.class, trace.getType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
-        assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
+        assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
         assertEquals("getName", TEST_STREAM, trace.getName());
 
@@ -173,7 +179,6 @@ public class TmfTraceTest extends TestCase {
             fail("IOException");
         }
 
-        assertFalse ("Open trace", trace == null);
         assertEquals("getType",  TmfEvent.class, trace.getType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
@@ -188,7 +193,8 @@ public class TmfTraceTest extends TestCase {
         assertEquals("getEndTime",     NB_EVENTS, trace.getEndTime().getValue());
     }
 
-    public void testFullConstructor() throws Exception {
+    @SuppressWarnings("null")
+    public void testFullConstructor() throws TmfTraceException {
         TmfTraceStub trace = null;
         File testfile = null;
         try {
@@ -217,7 +223,8 @@ public class TmfTraceTest extends TestCase {
         assertEquals("getEndTime",     NB_EVENTS, trace.getEndTime().getValue());
     }
 
-    public void testLiveTraceConstructor() throws Exception {
+    @SuppressWarnings("null")
+    public void testLiveTraceConstructor() throws TmfTraceException {
         TmfTraceStub trace = null;
         File testfile = null;
         final long interval = 100;
@@ -247,8 +254,8 @@ public class TmfTraceTest extends TestCase {
         assertEquals("getEndTime",     NB_EVENTS, trace.getEndTime().getValue());
     }
 
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public void testCopyConstructor() throws Exception {
+    @SuppressWarnings("null")
+    public void testCopyConstructor() throws TmfTraceException {
         TmfTraceStub original = null;
         TmfTraceStub trace = null;
         File testfile = null;
@@ -293,7 +300,7 @@ public class TmfTraceTest extends TestCase {
     // Trace initialization
     // ------------------------------------------------------------------------
 
-    public void testInitializeNullPath() throws Exception {
+    public void testInitializeNullPath() {
 
         // Instantiate an "empty" trace
         final TmfTraceStub trace = new TmfTraceStub();
@@ -301,14 +308,14 @@ public class TmfTraceTest extends TestCase {
         try {
             trace.initialize(null, null, TmfEvent.class);
             fail("TmfTrace.initialize() - no exception thrown");
-        } catch (FileNotFoundException e) {
+        } catch (TmfTraceException e) {
             // Success
         } catch (Exception e) {
             fail("TmfTrace.initialize() - wrong exception thrown");
         }
     }
-        
-    public void testInitializeSimplePath() throws Exception {
+
+    public void testInitializeSimplePath() {
 
         // Instantiate an "empty" trace
         final TmfTraceStub trace = new TmfTraceStub();
@@ -320,12 +327,11 @@ public class TmfTraceTest extends TestCase {
         } catch (Exception e) {
             fail("TmfTrace.initialize() - Exception thrown");
         }
-        
-        assertFalse ("Open trace", trace == null);
+
         assertEquals("getType", TmfEvent.class, trace.getType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", path, trace.getPath());
-        assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
+        assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
         assertEquals("getName", path, trace.getName());
 
@@ -336,7 +342,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("getEndTime",     Long.MIN_VALUE, trace.getEndTime().getValue());
     }
 
-    public void testInitializeNormalPath() throws Exception {
+    public void testInitializeNormalPath() {
 
         // Instantiate an "empty" trace
         final TmfTraceStub trace = new TmfTraceStub();
@@ -349,12 +355,11 @@ public class TmfTraceTest extends TestCase {
         } catch (Exception e) {
             fail("TmfTrace.initialize() - Exception thrown");
         }
-        
-        assertFalse ("Open trace", trace == null);
+
         assertEquals("getType", TmfEvent.class, trace.getType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", path, trace.getPath());
-        assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
+        assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
         assertEquals("getName", name, trace.getName());
 
@@ -365,15 +370,14 @@ public class TmfTraceTest extends TestCase {
         assertEquals("getEndTime",     Long.MIN_VALUE, trace.getEndTime().getValue());
     }
 
-    public void testInitTrace() throws Exception {
+    public void testInitTrace() throws URISyntaxException, IOException, TmfTraceException, InterruptedException {
 
         // Instantiate an "empty" trace
         final TmfTraceStub trace = new TmfTraceStub();
 
-        assertFalse ("Open trace", trace == null);
         assertNull  ("getType",  trace.getType());
         assertNull  ("getResource", trace.getResource());
-        assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
+        assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
         assertEquals("getName", "", trace.getName());
 
@@ -389,7 +393,8 @@ public class TmfTraceTest extends TestCase {
         assertTrue("validate", trace.validate(null, testfile.getPath()));
 
         // InitTrace and wait for indexing completion...
-        trace.initTrace(null, testfile.getPath(), TmfEvent.class);
+        trace.initTrace(null, testfile.toURI().getPath(), TmfEvent.class);
+        trace.indexTrace();
         int nbSecs = 0;
         while (trace.getNbEvents() < NB_EVENTS && nbSecs < 10) {
             Thread.sleep(1000);
@@ -399,10 +404,9 @@ public class TmfTraceTest extends TestCase {
             fail("indexing");
         }
 
-        assertFalse ("Open trace", trace == null);
         assertEquals("getType",  TmfEvent.class, trace.getType());
         assertNull  ("getResource", trace.getResource());
-        assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
+        assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
         assertEquals("getName", TEST_STREAM, trace.getName());
 
@@ -417,7 +421,7 @@ public class TmfTraceTest extends TestCase {
     // Set/Get streaming interval
     // ------------------------------------------------------------------------
 
-    public void testSetStreamingInterval() throws Exception {
+    public void testSetStreamingInterval() throws TmfTraceException {
         final TmfTraceStub trace = new TmfTraceStub(fTrace);
 
         long interval = 0;
@@ -426,15 +430,15 @@ public class TmfTraceTest extends TestCase {
         interval = 100;
         trace.setStreamingInterval(interval);
         assertEquals("getStreamingInterval", interval, trace.getStreamingInterval());
-        
+
         interval = -1;
         trace.setStreamingInterval(interval);
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-        
+
         interval = 0;
         trace.setStreamingInterval(interval);
         assertEquals("getStreamingInterval", interval, trace.getStreamingInterval());
-        
+
         trace.dispose();
     }
 
@@ -442,7 +446,7 @@ public class TmfTraceTest extends TestCase {
     // Set/Get time range
     // ------------------------------------------------------------------------
 
-    public void testSetTimeRange() throws Exception {
+    public void testSetTimeRange() throws TmfTraceException {
         final TmfTraceStub trace = new TmfTraceStub(fTrace);
         trace.indexTrace();
 
@@ -460,7 +464,7 @@ public class TmfTraceTest extends TestCase {
         trace.dispose();
     }
 
-    public void testSetStartTime() throws Exception {
+    public void testSetStartTime() throws TmfTraceException {
         final TmfTraceStub trace = new TmfTraceStub(fTrace);
         trace.indexTrace();
 
@@ -478,7 +482,7 @@ public class TmfTraceTest extends TestCase {
         trace.dispose();
     }
 
-    public void testSetEndTime() throws Exception {
+    public void testSetEndTime() throws TmfTraceException {
         final TmfTraceStub trace = new TmfTraceStub(fTrace);
         trace.indexTrace();
 
@@ -496,11 +500,32 @@ public class TmfTraceTest extends TestCase {
         trace.dispose();
     }
 
+    public void testSetNbEvents() throws TmfTraceException {
+        final TmfTraceStub trace = new TmfTraceStub(fTrace);
+        trace.indexTrace();
+
+        assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
+
+        trace.setNbEvents(0);
+        assertEquals("getNbEvents", 0, trace.getNbEvents());
+
+        trace.setNbEvents(-1);
+        assertEquals("getNbEvents", 0, trace.getNbEvents());
+
+        trace.setNbEvents(NB_EVENTS + 1);
+        assertEquals("getNbEvents", NB_EVENTS + 1, trace.getNbEvents());
+
+        trace.setNbEvents(NB_EVENTS);
+        assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
+
+        trace.dispose();
+    }
+
     // ------------------------------------------------------------------------
     // seekEvent on location (note: does not reliably set the rank)
     // ------------------------------------------------------------------------
 
-    public void testSeekEventOnCacheBoundary() throws Exception {
+    public void testSeekEventOnCacheBoundary() {
 
         // Position trace at event rank 0
         ITmfContext context = fTrace.seekEvent(0);
@@ -515,7 +540,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -528,7 +553,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1001, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1001, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -541,12 +566,12 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 4001, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 4001, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
     }
 
-    public void testSeekEventNotOnCacheBoundary() throws Exception {
+    public void testSeekEventNotOnCacheBoundary() {
 
         // Position trace at event rank 9
         ITmfContext tmpContext = fTrace.seekEvent(new TmfTimestamp(10, SCALE, 0));
@@ -557,7 +582,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 10, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 10, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -570,7 +595,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1000, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1000, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -583,7 +608,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1002, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1002, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -596,12 +621,12 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 4501, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 4501, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
     }
 
-    public void testSeekEventOutOfScope() throws Exception {
+    public void testSeekEventOutOfScope() {
 
         // Position trace at beginning
         ITmfContext tmpContext = fTrace.seekEvent(0);
@@ -612,29 +637,24 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
         // Position trace at event passed the end
-        tmpContext = fTrace.seekEvent(new TmfTimestamp(NB_EVENTS + 1, SCALE, 0));
-        context = fTrace.seekEvent(tmpContext.getLocation());
-        assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
-
-        event = fTrace.parseEvent(context);
-        assertEquals("Event timestamp", null, event);
+        context = fTrace.seekEvent(new TmfTimestamp(NB_EVENTS + 1, SCALE, 0));
+        assertNull("Event timestamp", context.getLocation());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
-        assertEquals("Event timestamp", null, event);
-        assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
+        event = fTrace.getNext(context);
+        assertNull("Event", event);
     }
 
     // ------------------------------------------------------------------------
     // seekEvent on timestamp (note: does not reliably set the rank)
     // ------------------------------------------------------------------------
 
-    public void testSeekEventOnNullTimestamp() throws Exception {
+    public void testSeekEventOnNullTimestamp() {
 
         // Position trace at event rank 0
         ITmfContext context = fTrace.seekEvent((ITmfTimestamp) null);
@@ -645,7 +665,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event rank", 0, context.getRank());
     }
 
-    public void testSeekEventOnTimestampOnCacheBoundary() throws Exception {
+    public void testSeekEventOnTimestampOnCacheBoundary() {
 
         // Position trace at event rank 0
         ITmfContext context = fTrace.seekEvent(new TmfTimestamp(1, SCALE, 0));
@@ -655,7 +675,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", 0, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", 1, context.getRank());
 
@@ -667,7 +687,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1001, event.getTimestamp().getValue());
         assertEquals("Event rank", 1000, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1001, event.getTimestamp().getValue());
         assertEquals("Event rank", 1001, context.getRank());
 
@@ -679,12 +699,12 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 4001, event.getTimestamp().getValue());
         assertEquals("Event rank", 4000, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 4001, event.getTimestamp().getValue());
         assertEquals("Event rank", 4001, context.getRank());
     }
 
-    public void testSeekEventOnTimestampNotOnCacheBoundary() throws Exception {
+    public void testSeekEventOnTimestampNotOnCacheBoundary() {
 
         // Position trace at event rank 1
         ITmfContext context = fTrace.seekEvent(new TmfTimestamp(2, SCALE, 0));
@@ -694,7 +714,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 2, event.getTimestamp().getValue());
         assertEquals("Event rank", 1, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 2, event.getTimestamp().getValue());
         assertEquals("Event rank", 2, context.getRank());
 
@@ -706,7 +726,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 10, event.getTimestamp().getValue());
         assertEquals("Event rank", 9, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 10, event.getTimestamp().getValue());
         assertEquals("Event rank", 10, context.getRank());
 
@@ -718,7 +738,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1000, event.getTimestamp().getValue());
         assertEquals("Event rank", 999, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1000, event.getTimestamp().getValue());
         assertEquals("Event rank", 1000, context.getRank());
 
@@ -730,7 +750,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1002, event.getTimestamp().getValue());
         assertEquals("Event rank", 1001, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1002, event.getTimestamp().getValue());
         assertEquals("Event rank", 1002, context.getRank());
 
@@ -742,12 +762,12 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 4501, event.getTimestamp().getValue());
         assertEquals("Event rank", 4500, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 4501, event.getTimestamp().getValue());
         assertEquals("Event rank", 4501, context.getRank());
     }
 
-    public void testSeekEventOnTimestampOutOfScope() throws Exception {
+    public void testSeekEventOnTimestampOutOfScope() {
 
         // Position trace at beginning
         ITmfContext context = fTrace.seekEvent(new TmfTimestamp(-1, SCALE, 0));
@@ -757,28 +777,28 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", 0, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", 1, context.getRank());
 
         // Position trace at event passed the end
         context = fTrace.seekEvent(new TmfTimestamp(NB_EVENTS + 1, SCALE, 0));
-        assertEquals("Event rank", NB_EVENTS, context.getRank());
+        assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
         event = fTrace.parseEvent(context);
         assertEquals("Event timestamp", null, event);
-        assertEquals("Event rank", NB_EVENTS, context.getRank());
+        assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", null, event);
-        assertEquals("Event rank", NB_EVENTS, context.getRank());
+        assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
     }
 
     // ------------------------------------------------------------------------
     // seekEvent on rank
     // ------------------------------------------------------------------------
 
-    public void testSeekEventOnNegativeRank() throws Exception {
+    public void testSeekEventOnNegativeRank() {
 
         // Position trace at event rank 0
         ITmfContext context = fTrace.seekEvent(-1);
@@ -789,7 +809,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event rank", 0, context.getRank());
     }
 
-    public void testSeekOnRankOnCacheBoundary() throws Exception {
+    public void testSeekOnRankOnCacheBoundary() {
 
         // On lower bound, returns the first event (ts = 1)
         ITmfContext context = fTrace.seekEvent(0);
@@ -799,7 +819,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", 0, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", 1, context.getRank());
 
@@ -811,7 +831,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1001, event.getTimestamp().getValue());
         assertEquals("Event rank", 1000, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1001, event.getTimestamp().getValue());
         assertEquals("Event rank", 1001, context.getRank());
 
@@ -823,12 +843,12 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 4001, event.getTimestamp().getValue());
         assertEquals("Event rank", 4000, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 4001, event.getTimestamp().getValue());
         assertEquals("Event rank", 4001, context.getRank());
     }
 
-    public void testSeekOnRankNotOnCacheBoundary() throws Exception {
+    public void testSeekOnRankNotOnCacheBoundary() {
 
         // Position trace at event rank 9
         ITmfContext context = fTrace.seekEvent(9);
@@ -838,7 +858,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 10, event.getTimestamp().getValue());
         assertEquals("Event rank", 9, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 10, event.getTimestamp().getValue());
         assertEquals("Event rank", 10, context.getRank());
 
@@ -850,7 +870,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1000, event.getTimestamp().getValue());
         assertEquals("Event rank", 999, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1000, event.getTimestamp().getValue());
         assertEquals("Event rank", 1000, context.getRank());
 
@@ -862,7 +882,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1002, event.getTimestamp().getValue());
         assertEquals("Event rank", 1001, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1002, event.getTimestamp().getValue());
         assertEquals("Event rank", 1002, context.getRank());
 
@@ -874,12 +894,12 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 4501, event.getTimestamp().getValue());
         assertEquals("Event rank", 4500, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 4501, event.getTimestamp().getValue());
         assertEquals("Event rank", 4501, context.getRank());
     }
 
-    public void testSeekEventOnRankOfScope() throws Exception {
+    public void testSeekEventOnRankOutOfScope() {
 
         // Position trace at beginning
         ITmfContext context = fTrace.seekEvent(-1);
@@ -889,7 +909,7 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", 0, context.getRank());
 
-        event = fTrace.readEvent(context);
+        event = fTrace.getNext(context);
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
         assertEquals("Event rank", 1, context.getRank());
 
@@ -898,11 +918,11 @@ public class TmfTraceTest extends TestCase {
         assertEquals("Event rank", NB_EVENTS, context.getRank());
 
         event = fTrace.parseEvent(context);
-        assertEquals("Event timestamp", null, event);
+        assertNull("Event", event);
         assertEquals("Event rank", NB_EVENTS, context.getRank());
 
-        event = fTrace.readEvent(context);
-        assertEquals("Event timestamp", null, event);
+        event = fTrace.getNext(context);
+        assertNull("Event", event);
         assertEquals("Event rank", NB_EVENTS, context.getRank());
     }
 
@@ -910,7 +930,7 @@ public class TmfTraceTest extends TestCase {
     // parseEvent - make sure parseEvent doesn't update the context
     // ------------------------------------------------------------------------
 
-    public void testParseEvent() throws Exception {
+    public void testParseEvent() {
 
         final int NB_READS = 20;
 
@@ -935,7 +955,7 @@ public class TmfTraceTest extends TestCase {
 
         // Position the trace at event NB_READS
         for (int i = 1; i < NB_READS; i++) {
-            event = fTrace.readEvent(context);
+            event = fTrace.getNext(context);
             assertEquals("Event timestamp", i, event.getTimestamp().getValue());
         }
 
@@ -952,48 +972,243 @@ public class TmfTraceTest extends TestCase {
     }
 
     // ------------------------------------------------------------------------
-    // readEvent - updates the context
+    // getNext - updates the context
     // ------------------------------------------------------------------------
 
-    public void testGetEvent() throws Exception {
+    public void testGetNextAfteSeekingOnTS_1() {
 
+        final long INITIAL_TS = 1;
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 1)
-        final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(0, SCALE, 0));
+        final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
 
         // Read NB_EVENTS
         ITmfEvent event;
         for (int i = 0; i < NB_READS; i++) {
-            event = fTrace.readEvent(context);
-            assertEquals("Event timestamp", i + 1, event.getTimestamp().getValue());
-            assertEquals("Event rank", i + 1, context.getRank());
+            event = fTrace.getNext(context);
+            assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
+            assertEquals("Event rank", INITIAL_TS + i, context.getRank());
         }
 
         // Make sure we stay positioned
         event = fTrace.parseEvent(context);
-        assertEquals("Event timestamp", NB_READS + 1, event.getTimestamp().getValue());
-        assertEquals("Event rank", NB_READS, context.getRank());
+        assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+        assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
+    }
+
+    public void testGetNextAfteSeekingOnTS_2() {
+
+        final long INITIAL_TS = 2;
+        final int NB_READS = 20;
+
+        // On lower bound, returns the first event (ts = 500)
+        final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+        // Read NB_EVENTS
+        ITmfEvent event;
+        for (int i = 0; i < NB_READS; i++) {
+            event = fTrace.getNext(context);
+            assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
+            assertEquals("Event rank", INITIAL_TS + i, context.getRank());
+        }
+
+        // Make sure we stay positioned
+        event = fTrace.parseEvent(context);
+        assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+        assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
+    }
+
+    public void testGetNextAfteSeekingOnTS_3() {
+
+        final long INITIAL_TS = 500;
+        final int NB_READS = 20;
+
+        // On lower bound, returns the first event (ts = 500)
+        final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+        // Read NB_EVENTS
+        ITmfEvent event;
+        for (int i = 0; i < NB_READS; i++) {
+            event = fTrace.getNext(context);
+            assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
+            assertEquals("Event rank", INITIAL_TS + i, context.getRank());
+        }
+
+        // Make sure we stay positioned
+        event = fTrace.parseEvent(context);
+        assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+        assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
+    }
+
+    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());
+    }
+
+    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());
+    }
+
+    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());
+    }
+
+    public void testGetNextAfterSeekingOnLocation_1() {
+
+        final ITmfLocation INITIAL_LOC = null;
+        final long INITIAL_TS = 1;
+        final int NB_READS = 20;
+
+        // On lower bound, returns the first event (ts = 1)
+        final ITmfContext context = fTrace.seekEvent(INITIAL_LOC);
+
+        // Read NB_EVENTS
+        ITmfEvent event;
+        for (int i = 0; i < NB_READS; i++) {
+            event = fTrace.getNext(context);
+            assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
+            assertEquals("Event rank", INITIAL_TS + i, context.getRank());
+        }
+
+        // Make sure we stay positioned
+        event = fTrace.parseEvent(context);
+        assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+        assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
+    }
+
+    public void testGetNextAfterSeekingOnLocation_2() {
+
+        final ITmfLocation INITIAL_LOC = fTrace.seekEvent(1L).getLocation();
+        final long INITIAL_TS = 2;
+        final int NB_READS = 20;
+
+        // On lower bound, returns the first event (ts = 501)
+        final ITmfContext context = fTrace.seekEvent(INITIAL_LOC);
+
+        // Read NB_EVENTS
+        ITmfEvent event;
+        for (int i = 0; i < NB_READS; i++) {
+            event = fTrace.getNext(context);
+            assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
+        }
+
+        // Make sure we stay positioned
+        event = fTrace.parseEvent(context);
+        assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+    }
+
+    public void testGetNextAfterSeekingOnLocation_3() {
+
+        final ITmfLocation INITIAL_LOC = fTrace.seekEvent(500L).getLocation();
+        final long INITIAL_TS = 501;
+        final int NB_READS = 20;
+
+        // On lower bound, returns the first event (ts = 501)
+        final ITmfContext context = fTrace.seekEvent(INITIAL_LOC);
+
+        // Read NB_EVENTS
+        ITmfEvent event;
+        for (int i = 0; i < NB_READS; i++) {
+            event = fTrace.getNext(context);
+            assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
+        }
+
+        // Make sure we stay positioned
+        event = fTrace.parseEvent(context);
+        assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+    }
+
+    public void testGetNextLocation() {
+        ITmfContext context1 = fTrace.seekEvent(0);
+        fTrace.getNext(context1);
+        ITmfLocation location = context1.getLocation();
+        ITmfEvent event1 = fTrace.getNext(context1);
+        ITmfContext context2 = fTrace.seekEvent(location);
+        ITmfEvent event2 = fTrace.getNext(context2);
+        assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
+    }
+
+    public void testGetNextEndLocation() {
+        ITmfContext context1 = fTrace.seekEvent(fTrace.getNbEvents() - 1);
+        fTrace.getNext(context1);
+        ITmfLocation location = context1.getLocation();
+        ITmfContext context2 = fTrace.seekEvent(location);
+        ITmfEvent event = fTrace.getNext(context2);
+        assertNull("Event", event);
     }
 
     // ------------------------------------------------------------------------
     // processRequest
     // ------------------------------------------------------------------------
 
-    @SuppressWarnings("unchecked")
-    public void testProcessEventRequestForAllEvents() throws Exception {
+    @SuppressWarnings("hiding")
+    public void testProcessEventRequestForAllEvents() throws InterruptedException {
         final int BLOCK_SIZE =  1;
-        final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
+        final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+        final TmfEventRequest request = new TmfEventRequest(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
             }
         };
-        final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
+        final ITmfDataProvider[] providers = TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
         providers[0].sendRequest(request);
         request.waitForCompletion();
 
@@ -1008,21 +1223,21 @@ public class TmfTraceTest extends TestCase {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    public void testProcessEventRequestForNbEvents() throws Exception {
+    @SuppressWarnings("hiding")
+    public void testProcessEventRequestForNbEvents() throws InterruptedException {
         final int BLOCK_SIZE = 100;
         final int NB_EVENTS  = 1000;
-        final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
+        final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+        final TmfEventRequest request = new TmfEventRequest(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
             }
         };
-        final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
+        final ITmfDataProvider[] providers = TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
         providers[0].sendRequest(request);
         request.waitForCompletion();
 
@@ -1037,22 +1252,22 @@ public class TmfTraceTest extends TestCase {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    public void testProcessEventRequestForSomeEvents() throws Exception {
+    @SuppressWarnings("hiding")
+    public void testProcessEventRequestForSomeEvents() throws InterruptedException {
         final int BLOCK_SIZE =  1;
         final long startTime = 100;
         final int NB_EVENTS  = 1000;
-        final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
+        final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+        final TmfEventRequest request = new TmfEventRequest(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
             }
         };
-        final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
+        final ITmfDataProvider[] providers = TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
         providers[0].sendRequest(request);
         request.waitForCompletion();
 
@@ -1067,23 +1282,23 @@ public class TmfTraceTest extends TestCase {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    public void testProcessEventRequestForOtherEvents() throws Exception {
+    @SuppressWarnings("hiding")
+    public void testProcessEventRequestForOtherEvents() throws InterruptedException {
         final int BLOCK_SIZE =  1;
         final int startIndex = 99;
         final long startTime = 100;
         final int NB_EVENTS  = 1000;
-        final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
+        final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, startIndex, NB_EVENTS, BLOCK_SIZE) {
+        final TmfEventRequest request = new TmfEventRequest(TmfEvent.class, range, startIndex, NB_EVENTS, BLOCK_SIZE) {
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
             }
         };
-        final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
+        final ITmfDataProvider[] providers = TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
         providers[0].sendRequest(request);
         request.waitForCompletion();
 
@@ -1098,20 +1313,20 @@ public class TmfTraceTest extends TestCase {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    public void testProcessDataRequestForSomeEvents() throws Exception {
+    @SuppressWarnings("hiding")
+    public void testProcessDataRequestForSomeEvents() throws InterruptedException {
         final int startIndex = 100;
         final int NB_EVENTS  = 1000;
-        final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
+        final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
-        final TmfDataRequest<TmfEvent> request = new TmfDataRequest<TmfEvent>(TmfEvent.class, startIndex, NB_EVENTS) {
+        final TmfDataRequest request = new TmfDataRequest(TmfEvent.class, startIndex, NB_EVENTS) {
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
             }
         };
-        final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
+        final ITmfDataProvider[] providers = TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
         providers[0].sendRequest(request);
         request.waitForCompletion();
 
@@ -1130,15 +1345,14 @@ public class TmfTraceTest extends TestCase {
     // cancel
     // ------------------------------------------------------------------------
 
-    @SuppressWarnings("unchecked")
-    public void testCancel() throws Exception {
-        final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
+    public void testCancel() throws InterruptedException {
+        final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+        final TmfEventRequest request = new TmfEventRequest(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
             int nbRead = 0;
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
                 if (++nbRead == BLOCK_SIZE) {
@@ -1146,7 +1360,7 @@ public class TmfTraceTest extends TestCase {
                 }
             }
         };
-        final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
+        final ITmfDataProvider[] providers = TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
         providers[0].sendRequest(request);
         request.waitForCompletion();
 
@@ -1159,7 +1373,7 @@ public class TmfTraceTest extends TestCase {
     // toString
     // ------------------------------------------------------------------------
 
-    public void testDefaultTmfTraceStub() throws Exception {
+    public void testDefaultTmfTraceStub() {
         assertFalse ("Open trace", fTrace == null);
         assertEquals("getType",  TmfEvent.class, fTrace.getType());
         assertNull  ("getResource", fTrace.getResource());
@@ -1180,4 +1394,4 @@ public class TmfTraceTest extends TestCase {
         assertEquals("toString", expected, fTrace.toString());
     }
 
-}
\ No newline at end of file
+}
This page took 0.070894 seconds and 5 git commands to generate.