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 :
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;
testStream = null;
}
}
+ else {
+ testStream.seekEvent(0);
+ }
+
return testStream;
}
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);
public void testConstructors() {
LttngEvent testEvent = null;
- @SuppressWarnings("unused")
+ LTTngTrace testTrace = null;
+ @SuppressWarnings("unused")
LttngEvent testAnotherEvent = null;
LttngTimestamp testTime = null;
TmfEventSource testSource = null;
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");
}
// 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!");
assertEquals("Channel not what expected!",eventChannel,testEvent.getChannelName());
assertEquals("CpuId not what expected!",eventCpu,testEvent.getCpuId());
assertEquals("Marker not what expected!",eventMarker,testEvent.getMarkerName());
- assertEquals("Content not what expected!",eventContent,testEvent.getContent().toString());
+
+ // 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
+ //
+ //assertEquals("Content not what expected!",eventContent,testEvent.getContent().toString());
+ assertNotSame("Content is null!", null,testEvent.getContent());
}
public void testSetter() {
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 {