tmf: Merge TmfEventProvider#getType() and ITmfTrace#getEventType()
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 4 Sep 2015 21:44:32 +0000 (17:44 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 11 Sep 2015 17:48:15 +0000 (13:48 -0400)
TmfTrace has access to both getType() and getEventType(), which
come from two separate super class/interface, but do the exact
same thing.

We can simplify this by only declaring it once, in ITmfEventProvider
(which ITmfTrace extends).

Change-Id: I8a605da5bfd28548d36cd4ce18a1e94d48698176
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/55344
Reviewed-by: Hudson CI
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/trace/CtfTmfTraceTest.java
pcap/org.eclipse.tracecompass.tmf.pcap.core.tests/src/org/eclipse/tracecompass/tmf/pcap/core/tests/trace/PcapTraceTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfTraceTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/text/TextTraceTest.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/component/ITmfEventProvider.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/component/TmfEventProvider.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/ITmfTrace.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTrace.java

index 63fffffbd7e4aa6f1998127c8933e3c7480aef5d..9cda922f09af32001a643298e3b3ad7b6418f30e 100644 (file)
@@ -95,7 +95,7 @@ public class CtfTmfTraceTest {
         assertEquals(0L, result.getNbEvents());
         assertEquals(0L, result.getStreamingInterval());
         assertNull(result.getResource());
-        assertNull(result.getType());
+        assertNull(result.getEventType());
 
         result.dispose();
     }
index 2c897baaf83601253631e0f0921218e86e17881c..35a599ea74f0431c1eaf03a0a8ad38d99d92eb7a 100644 (file)
@@ -81,7 +81,7 @@ public class PcapTraceTest {
         assertEquals(0L, result.getNbEvents());
         assertEquals(0L, result.getStreamingInterval());
         assertNull(result.getResource());
-        assertNull(result.getType());
+        assertNull(result.getEventType());
 
         result.dispose();
     }
index 840893f3574f551305c36eea1d28ee1ed40cc22f..10a5811380c45e9cc2e5eff624b04e87577a0ccf 100644 (file)
@@ -119,7 +119,7 @@ public class TmfTraceTest {
             TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
             trace.indexTrace(true);
 
-            assertEquals("getType", ITmfEvent.class, trace.getType());
+            assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
             assertNull("getResource", trace.getResource());
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
             assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
@@ -148,7 +148,7 @@ public class TmfTraceTest {
             TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, interval);
             trace.indexTrace(true);
 
-            assertEquals("getType", ITmfEvent.class, trace.getType());
+            assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
             assertNull("getResource", trace.getResource());
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
             assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
@@ -177,7 +177,7 @@ public class TmfTraceTest {
             TmfTraceStub trace = new TmfTraceStub(original);
             trace.indexTrace(true);
 
-            assertEquals("getType", ITmfEvent.class, trace.getType());
+            assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
             assertNull("getResource", trace.getResource());
             assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
             assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
@@ -239,7 +239,7 @@ public class TmfTraceTest {
             fail("TmfTrace.initialize() - Exception thrown");
         }
 
-        assertEquals("getType", ITmfEvent.class, trace.getType());
+        assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", path, trace.getPath());
         assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
@@ -267,7 +267,7 @@ public class TmfTraceTest {
             fail("TmfTrace.initialize() - Exception thrown");
         }
 
-        assertEquals("getType", ITmfEvent.class, trace.getType());
+        assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getPath", path, trace.getPath());
         assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
@@ -286,7 +286,7 @@ public class TmfTraceTest {
         // Instantiate an "empty" trace
         final TmfTraceStub trace = new TmfTraceStub();
 
-        assertNull  ("getType",  trace.getType());
+        assertNull  ("getEventType",  trace.getEventType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
@@ -315,7 +315,7 @@ public class TmfTraceTest {
             fail("indexing");
         }
 
-        assertEquals("getType", ITmfEvent.class, trace.getType());
+        assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
         assertNull  ("getResource", trace.getResource());
         assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
         assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
@@ -1338,7 +1338,7 @@ public class TmfTraceTest {
     @Test
     public void testDefaultTmfTraceStub() {
         assertFalse ("Open trace", fTrace == null);
-        assertEquals("getType",  ITmfEvent.class, fTrace.getType());
+        assertEquals("getEventType",  ITmfEvent.class, fTrace.getEventType());
         assertNull  ("getResource", fTrace.getResource());
         assertEquals("getStreamingInterval", 0, fTrace.getStreamingInterval());
         assertEquals("getName", TEST_TRACE.getPath(), fTrace.getName());
index be6c6bfe06801b40fb644e4fa61c4c0e96bd83ca..a51fd3d6f673105b28f8258d9ac2e3325a117a22 100644 (file)
@@ -122,7 +122,7 @@ public class TextTraceTest {
     @Test
     public void testEmptyConstructor() {
         SyslogTrace trace = new SyslogTrace();
-        assertEquals("getType",      null, trace.getType());
+        assertEquals("getEventType",      null, trace.getEventType());
         assertEquals("getPath",      null, trace.getPath());
         assertEquals("getName",      "", trace.getName());
         assertEquals("getCacheSize", 100, trace.getCacheSize());
@@ -162,7 +162,7 @@ public class TextTraceTest {
         SyslogTrace trace = new SyslogTrace();
         IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(PATH));
         trace.initTrace(resource, path, SyslogEvent.class);
-        assertEquals("getType",      SyslogEvent.class, trace.getType());
+        assertEquals("getEventType",      SyslogEvent.class, trace.getEventType());
         assertEquals("getPath",      fTestFile.toURI().getPath(), trace.getPath());
         assertEquals("getName",      NAME, trace.getName());
         assertEquals("getCacheSize", 100, trace.getCacheSize());
index 6f9c68b5956944968917782cfe3df428eadd2343..e1dadb9c2731ca11eec1dc8fa26310415095036a 100644 (file)
@@ -49,6 +49,14 @@ public interface ITmfEventProvider extends ITmfComponent {
      */
     void notifyPendingRequest(boolean isIncrement);
 
+    /**
+     * Get the event type this provider handles
+     *
+     * @return The type of ITmfEvent
+     * @since 2.0
+     */
+    Class<? extends ITmfEvent> getEventType();
+
     /**
      * Return the next event based on the context supplied. The context
      * will be updated for the subsequent read.
index a98067d33261280fe97cedc49ec3015cad56907d..a20b2a9f35b39d4522c1fc39e66f70b15988ba70 100644 (file)
@@ -169,11 +169,10 @@ public abstract class TmfEventProvider extends TmfComponent implements ITmfEvent
     // ------------------------------------------------------------------------
 
     /**
-     * Get the event type this provider handles
-     *
-     * @return The type of ITmfEvent
+     * @since 2.0
      */
-    public Class<? extends ITmfEvent> getType() {
+    @Override
+    public Class<? extends ITmfEvent> getEventType() {
         return fType;
     }
 
index 7d2d768f691e4a3b6d946f24aff226c0ffb4be35..56b7ba45a7f38bc103d448cce86559b878eb0e95 100644 (file)
@@ -202,11 +202,6 @@ public interface ITmfTrace extends ITmfEventProvider {
     // Basic getters
     // ------------------------------------------------------------------------
 
-    /**
-     * @return the trace event type
-     */
-    Class<? extends ITmfEvent> getEventType();
-
     /**
      * @return the associated trace resource
      */
index ec827e60fac2a6b360c1c7239ae5965a1d8672e1..539e8fdb73e548b91887554c574915072e36311a 100644 (file)
@@ -350,11 +350,6 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace, IT
     // ITmfTrace - Basic getters
     // ------------------------------------------------------------------------
 
-    @Override
-    public Class<? extends ITmfEvent> getEventType() {
-        return super.getType();
-    }
-
     @Override
     public IResource getResource() {
         return fResource;
This page took 0.031719 seconds and 5 git commands to generate.