Remove the generic location (replace by Comparable)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core.tests / src / org / eclipse / linuxtools / tmf / core / tests / trace / TmfMultiTraceExperimentTest.java
index 6b4c46e24a8c06a40edb07fb34c0ab579baab440..09840f791069d6ef230c6105756f6f85fce88dbd 100644 (file)
@@ -41,7 +41,7 @@ import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
 /**
  * Test suite for the TmfExperiment class (multiple traces).
  */
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
 public class TmfMultiTraceExperimentTest extends TestCase {
 
     // ------------------------------------------------------------------------
@@ -55,8 +55,8 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     private static int          NB_EVENTS    = 20000;
     private static int          BLOCK_SIZE   = 1000;
 
-    private static ITmfTrace<TmfEvent>[] fTraces;
-    private static TmfExperimentStub<TmfEvent> fExperiment;
+    private static ITmfTrace[] fTraces;
+    private static TmfExperimentStub fExperiment;
 
     private static byte SCALE = (byte) -3;
 
@@ -64,8 +64,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     // Housekeeping
     // ------------------------------------------------------------------------
 
-    @SuppressWarnings("unchecked")
-    private synchronized static ITmfTrace<?>[] setupTrace(final String path1, final String path2) {
+    private synchronized static ITmfTrace[] setupTrace(final String path1, final String path2) {
         if (fTraces == null) {
             fTraces = new ITmfTrace[2];
             try {
@@ -88,7 +87,10 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         return fTraces;
     }
 
-    public TmfMultiTraceExperimentTest(final String name) throws Exception {
+    /**
+     * @param name the test name
+     */
+    public TmfMultiTraceExperimentTest(final String name) {
         super(name);
     }
 
@@ -97,7 +99,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         super.setUp();
         setupTrace(DIRECTORY + File.separator + TEST_STREAM1, DIRECTORY + File.separator + TEST_STREAM2);
         if (fExperiment == null) {
-            fExperiment = new TmfExperimentStub<TmfEvent>(EXPERIMENT, fTraces, BLOCK_SIZE);
+            fExperiment = new TmfExperimentStub(EXPERIMENT, fTraces, BLOCK_SIZE);
             fExperiment.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
         }
     }
@@ -125,7 +127,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     // seekEvent on rank
     // ------------------------------------------------------------------------
 
-    public void testSeekRankOnCacheBoundary() throws Exception {
+    public void testSeekRankOnCacheBoundary() {
 
         long cacheSize = fExperiment.getCacheSize();
 
@@ -154,7 +156,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         assertEquals("Context rank", 4 * cacheSize + 1, context.getRank());
     }
 
-    public void testSeekRankNotOnCacheBoundary() throws Exception {
+    public void testSeekRankNotOnCacheBoundary() {
 
         long cacheSize = fExperiment.getCacheSize();
 
@@ -191,7 +193,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         assertEquals("Context rank", 4501, context.getRank());
     }
 
-    public void testSeekRankOutOfScope() throws Exception {
+    public void testSeekRankOutOfScope() {
 
         // Position trace at beginning
         ITmfContext context = fExperiment.seekEvent(-1);
@@ -214,7 +216,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     // seekEvent on timestamp
     // ------------------------------------------------------------------------
 
-    public void testSeekTimestampOnCacheBoundary() throws Exception {
+    public void testSeekTimestampOnCacheBoundary() {
 
         long cacheSize = fExperiment.getCacheSize();
 
@@ -243,7 +245,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         assertEquals("Context rank", 4 * cacheSize + 1, context.getRank());
     }
 
-    public void testSeekTimestampNotOnCacheBoundary() throws Exception {
+    public void testSeekTimestampNotOnCacheBoundary() {
 
         // Position trace at event rank 1 (TS = 2)
         ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(2, SCALE, 0));
@@ -286,7 +288,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         assertEquals("Context rank", 4501, context.getRank());
     }
 
-    public void testSeekTimestampOutOfScope() throws Exception {
+    public void testSeekTimestampOutOfScope() {
 
         // Position trace at beginning
         ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(-1, SCALE, 0));
@@ -307,7 +309,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     // seekEvent by location (context rank is undefined)
     // ------------------------------------------------------------------------
 
-    public void testSeekLocationOnCacheBoundary() throws Exception {
+    public void testSeekLocationOnCacheBoundary() {
 
         long cacheSize = fExperiment.getCacheSize();
 
@@ -342,7 +344,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         assertEquals("Event timestamp", 4 * cacheSize + 2, event.getTimestamp().getValue());
     }
 
-    public void testSeekLocationNotOnCacheBoundary() throws Exception {
+    public void testSeekLocationNotOnCacheBoundary() {
 
         long cacheSize = fExperiment.getCacheSize();
 
@@ -378,10 +380,10 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         assertEquals("Event timestamp", 4502, event.getTimestamp().getValue());
     }
 
-    public void testSeekLocationOutOfScope() throws Exception {
+    public void testSeekLocationOutOfScope() {
 
         // Position trace at beginning
-        ITmfContext context = fExperiment.seekEvent((ITmfLocation<?>) null);
+        ITmfContext context = fExperiment.seekEvent((ITmfLocation) null);
 
         ITmfEvent event = fExperiment.getNext(context);
         assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
@@ -391,7 +393,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     // getNext - updates the context
     // ------------------------------------------------------------------------
 
-    private void validateContextRanks(ITmfContext context) {
+    private static void validateContextRanks(ITmfContext context) {
         assertTrue("Experiment context type", context instanceof TmfExperimentContext);
         TmfExperimentContext ctx = (TmfExperimentContext) context;
 
@@ -410,7 +412,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         assertEquals("Experiment context rank", expRank, ctx.getRank());
     }
 
-    public void testGetNextAfteSeekingOnTS_1() throws Exception {
+    public void testGetNextAfteSeekingOnTS_1() {
 
         final long INITIAL_TS = 1;
         final int NB_READS = 20;
@@ -436,7 +438,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         validateContextRanks(context);
     }
 
-    public void testGetNextAfteSeekingOnTS_2() throws Exception {
+    public void testGetNextAfteSeekingOnTS_2() {
 
         final long INITIAL_TS = 2;
         final int NB_READS = 20;
@@ -462,7 +464,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         validateContextRanks(context);
     }
 
-    public void testGetNextAfteSeekingOnTS_3() throws Exception {
+    public void testGetNextAfteSeekingOnTS_3() {
 
         final long INITIAL_TS = 500;
         final int NB_READS = 20;
@@ -488,7 +490,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         validateContextRanks(context);
     }
 
-    public void testGetNextAfterSeekingOnRank_1() throws Exception {
+    public void testGetNextAfterSeekingOnRank_1() {
 
         final long INITIAL_RANK = 0L;
         final int NB_READS = 20;
@@ -514,7 +516,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         validateContextRanks(context);
     }
 
-    public void testGetNextAfterSeekingOnRank_2() throws Exception {
+    public void testGetNextAfterSeekingOnRank_2() {
 
         final long INITIAL_RANK = 1L;
         final int NB_READS = 20;
@@ -540,7 +542,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         validateContextRanks(context);
     }
 
-    public void testGetNextAfterSeekingOnRank_3() throws Exception {
+    public void testGetNextAfterSeekingOnRank_3() {
 
         final long INITIAL_RANK = 500L;
         final int NB_READS = 20;
@@ -566,9 +568,9 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         validateContextRanks(context);
     }
 
-    public void testGetNextAfterSeekingOnLocation_1() throws Exception {
+    public void testGetNextAfterSeekingOnLocation_1() {
 
-        final ITmfLocation<?> INITIAL_LOC = null;
+        final ITmfLocation INITIAL_LOC = null;
         final long INITIAL_TS = 1;
         final int NB_READS = 20;
 
@@ -593,9 +595,9 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         validateContextRanks(context);
     }
 
-    public void testGetNextAfterSeekingOnLocation_2() throws Exception {
+    public void testGetNextAfterSeekingOnLocation_2() {
 
-        final ITmfLocation<?> INITIAL_LOC = fExperiment.seekEvent(1L).getLocation();
+        final ITmfLocation INITIAL_LOC = fExperiment.seekEvent(1L).getLocation();
         final long INITIAL_TS = 2;
         final int NB_READS = 20;
 
@@ -618,9 +620,9 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         validateContextRanks(context);
     }
 
-    public void testGetNextAfterSeekingOnLocation_3() throws Exception {
+    public void testGetNextAfterSeekingOnLocation_3() {
 
-        final ITmfLocation<?> INITIAL_LOC = fExperiment.seekEvent(500L).getLocation();
+        final ITmfLocation INITIAL_LOC = fExperiment.seekEvent(500L).getLocation();
         final long INITIAL_TS = 501;
         final int NB_READS = 20;
 
@@ -643,20 +645,20 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         validateContextRanks(context);
     }
 
-    public void testGetNextLocation() throws Exception {
+    public void testGetNextLocation() {
         ITmfContext context1 = fExperiment.seekEvent(0);
         fExperiment.getNext(context1);
-        ITmfLocation<?> location = context1.getLocation().clone();
+        ITmfLocation location = context1.getLocation().clone();
         ITmfEvent event1 = fExperiment.getNext(context1);
         ITmfContext context2 = fExperiment.seekEvent(location);
         ITmfEvent event2 = fExperiment.getNext(context2);
         assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
     }
 
-    public void testGetNextEndLocation() throws Exception {
+    public void testGetNextEndLocation() {
         ITmfContext context1 = fExperiment.seekEvent(fExperiment.getNbEvents() - 1);
         fExperiment.getNext(context1);
-        ITmfLocation<?> location = context1.getLocation().clone();
+        ITmfLocation location = context1.getLocation().clone();
         ITmfContext context2 = fExperiment.seekEvent(location);
         ITmfEvent event = fExperiment.getNext(context2);
         assertNull("Event", event);
@@ -666,16 +668,16 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     // processRequest
     // ------------------------------------------------------------------------
 
-    public void testProcessRequestForNbEvents() throws Exception {
+    public void testProcessRequestForNbEvents() throws InterruptedException {
 
         final int blockSize = 100;
         final int nbEvents  = 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, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(TmfEvent.class, range, nbEvents, blockSize) {
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
             }
@@ -694,16 +696,16 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         }
     }
 
-    public void testProcessRequestForNbEvents2() throws Exception {
+    public void testProcessRequestForNbEvents2() throws InterruptedException {
 
         final int blockSize = 2 * NB_EVENTS;
         final int nbEvents = 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, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(TmfEvent.class, range, nbEvents, blockSize) {
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
             }
@@ -722,17 +724,17 @@ public class TmfMultiTraceExperimentTest extends TestCase {
         }
     }
 
-    public void testProcessRequestForAllEvents() throws Exception {
+    public void testProcessRequestForAllEvents() throws InterruptedException {
 
         final int nbEvents  = TmfDataRequest.ALL_DATA;
         final int blockSize =  1;
-        final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
+        final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
         final long nbExpectedEvents = NB_EVENTS;
 
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
-        final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(TmfEvent.class, range, nbEvents, blockSize) {
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
             }
@@ -755,17 +757,17 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     // cancel
     // ------------------------------------------------------------------------
 
-    public void testCancel() throws Exception {
+    public void testCancel() throws InterruptedException {
 
         final int nbEvents  = NB_EVENTS;
         final int blockSize = BLOCK_SIZE;
-        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, nbEvents, blockSize) {
+        final TmfEventRequest request = new TmfEventRequest(TmfEvent.class, range, nbEvents, blockSize) {
             int nbRead = 0;
             @Override
-            public void handleData(final TmfEvent event) {
+            public void handleData(final ITmfEvent event) {
                 super.handleData(event);
                 requestedEvents.add(event);
                 if (++nbRead == blockSize) {
@@ -791,7 +793,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     // getTimestamp
     // ------------------------------------------------------------------------
 
-    public void testGetTimestamp() throws Exception {
+    public void testGetTimestamp() {
         assertEquals("getTimestamp", new TmfTimestamp(    1, (byte) -3), fExperiment.getTimestamp(    0));
         assertEquals("getTimestamp", new TmfTimestamp(    2, (byte) -3), fExperiment.getTimestamp(    1));
         assertEquals("getTimestamp", new TmfTimestamp(   11, (byte) -3), fExperiment.getTimestamp(   10));
This page took 0.029878 seconds and 5 git commands to generate.