Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.tests / src / org / eclipse / linuxtools / lttng / tests / event / LttngEventTest.java
index ab2be8d7a4dd8d56417019fdd9d08cb582ea08b5..f713dcf887a0861a842ec418b5d4a7cb9e43f4c5 100644 (file)
@@ -15,8 +15,10 @@ import org.eclipse.linuxtools.lttng.event.LttngTimestamp;
 import org.eclipse.linuxtools.lttng.jni.JniEvent;
 import org.eclipse.linuxtools.lttng.tests.LTTngCoreTestPlugin;
 import org.eclipse.linuxtools.lttng.trace.LTTngTextTrace;
+import org.eclipse.linuxtools.lttng.trace.LTTngTrace;
 import org.eclipse.linuxtools.tmf.event.TmfEventSource;
-import org.eclipse.linuxtools.tmf.trace.TmfTraceContext;
+import org.eclipse.linuxtools.tmf.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.trace.TmfLocation;
 
 /*
  Functions tested here :
@@ -38,17 +40,18 @@ import org.eclipse.linuxtools.tmf.trace.TmfTraceContext;
        public String toString()
  */
 
+@SuppressWarnings("nls")
 public class LttngEventTest extends TestCase {
     private final static String tracepath1="traceset/trace-15316events_nolost_newformat.txt";
     private final static boolean skipIndexing=true;
     
-    private final static long   eventTimestamp         = 13589759412127L;
+    private final static long   eventTimestamp         = 13589759412128L;
     private final static String eventSource    = "Kernel Core";
     private final static String eventType              = "metadata/0/core_marker_id";
     private final static String eventChannel   = "metadata";
     private final static long  eventCpu                = 0;
     private final static String eventMarker    = "core_marker_id";
-    private final static String eventContent   = "alignment:0 size_t:4 int:4 name:vm_map pointer:4 event_id:0 long:4 channel:vm_state ";
+//    private final static String eventContent         = "alignment:0 size_t:4 int:4 name:vm_map pointer:4 event_id:0 long:4 channel:vm_state ";
     private final static String eventReference         = eventChannel + "_" + eventCpu;
     
     
@@ -66,6 +69,10 @@ public class LttngEventTest extends TestCase {
                                testStream = null;
                        }
                }
+               else {
+                       testStream.seekEvent(0);
+               }
+               
                return testStream;
        }
 
@@ -74,7 +81,7 @@ public class LttngEventTest extends TestCase {
                
                try {
                        LTTngTextTrace tmpStream = initializeEventStream();
-                       tmpEvent = (LttngEvent)tmpStream.getNextEvent(new TmfTraceContext(0, new LttngTimestamp(0L), 0) );
+                       tmpEvent = (LttngEvent)tmpStream.getNextEvent(new TmfContext(new TmfLocation<Long>(0L), 0) );
                }
                catch (Exception e) {
                        System.out.println("ERROR : Could not open " + tracepath1);
@@ -85,7 +92,8 @@ public class LttngEventTest extends TestCase {
 
        public void testConstructors() {
         LttngEvent                     testEvent               = null;
-        @SuppressWarnings("unused")
+        LTTngTrace                     testTrace               = null;
+               @SuppressWarnings("unused")
                LttngEvent                      testAnotherEvent = null;
         LttngTimestamp         testTime                = null;
         TmfEventSource                 testSource              = null;
@@ -103,7 +111,7 @@ public class LttngEventTest extends TestCase {
                 testEvent      = null;
                 testTime       = new LttngTimestamp(0L);
                 testSource     = new TmfEventSource("test");
-                testType       = new LttngEventType("test", 0L, "test", testMarkerFields);
+                testType       = new LttngEventType("test", 0L, "test", 0, testMarkerFields);
                 testContent    = new LttngEventContent(testEvent);
                 testReference = new LttngEventReference("test", "test");
         }
@@ -113,7 +121,7 @@ public class LttngEventTest extends TestCase {
                
         // Test constructor with correct information
         try {
-                       testEvent = new LttngEvent( testTime, testSource, testType, testContent, testReference, testJniEvent);
+                       testEvent = new LttngEvent(testTrace, testTime, testSource, testType, testContent, testReference, testJniEvent);
         }
         catch( Exception e) { 
                 fail("Construction with correct information failed!");
@@ -153,6 +161,9 @@ public class LttngEventTest extends TestCase {
        assertEquals("CpuId not what expected!",eventCpu,testEvent.getCpuId());
        assertEquals("Marker not what expected!",eventMarker,testEvent.getMarkerName());
        
+       // All events should have a parent
+       assertNotNull("Trace parent for this event is null!", testEvent.getParentTrace() );
+       
        // *** FIXME ***
        // Depending from the Java version because of the "hashcode()" on String. 
        // We can't really test that safetly
@@ -169,7 +180,7 @@ public class LttngEventTest extends TestCase {
         JniEvent                       testJniEvent    = null;
                
         String[] testMarkerFields = new String[1];
-        testType       = new LttngEventType("test", 0L, "test", testMarkerFields);
+        testType       = new LttngEventType("test", 0L, "test", 0, testMarkerFields);
         testContent    = new LttngEventContent(testEvent);
         
        try {
This page took 0.039038 seconds and 5 git commands to generate.