use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class TmfEventTest method testTmfEventCopy.
@Test
public void testTmfEventCopy() {
final ITmfEvent event = new TmfEvent(fEvent1);
assertNotNull("getTrace", event.getTrace());
assertEquals("getRank", 0, event.getRank());
assertEquals("getTimestamp", fTimestamp1, event.getTimestamp());
assertEquals("getType", fType, event.getType());
assertEquals("getContent", fContent1, event.getContent());
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class TmfEventTest method testNoRankConstructor.
@Test
public void testNoRankConstructor() {
final ITmfEvent event = new TmfEvent(fTrace, ITmfContext.UNKNOWN_RANK, fTimestamp1, fType, fContent1);
assertNotNull("getTrace", event.getTrace());
assertEquals("getRank", ITmfContext.UNKNOWN_RANK, event.getRank());
assertEquals("getTimestamp", fTimestamp1, event.getTimestamp());
assertEquals("getType", fType, event.getType());
assertEquals("getContent", fContent1, event.getContent());
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class TmfEventTest method testDefaultConstructor.
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
@Test
public void testDefaultConstructor() {
final ITmfEvent event = new TmfEvent(fTrace, ITmfContext.UNKNOWN_RANK, null, null, null);
assertNotNull("getTrace", event.getTrace());
assertEquals("getRank", ITmfContext.UNKNOWN_RANK, event.getRank());
assertEquals("getTimestamp", TmfTimestamp.ZERO, event.getTimestamp());
assertNull("getType", event.getType());
assertNull("getContent", event.getContent());
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class TmfEventTest method testNonEqualTraces.
@Test
public void testNonEqualTraces() {
final ITmfTrace trace1 = fTrace;
final ITmfTrace trace2 = STUB_TRACE.getTrace();
final ITmfEvent event1 = new TmfEvent(trace1, 0, fTimestamp1, fType, fContent1);
ITmfEvent event2 = new TmfEvent(trace1, 0, fTimestamp1, fType, fContent1);
assertTrue("equals", event1.equals(event2));
assertTrue("equals", event2.equals(event1));
event2 = new TmfEvent(trace2, 0, fTimestamp1, fType, fContent1);
assertFalse("equals", event1.equals(event2));
assertFalse("equals", event2.equals(event1));
trace2.dispose();
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class TmfUml2SDTestTrace method parseEvent.
@Override
public ITmfEvent parseEvent(ITmfContext context) {
if (!(fEventStream instanceof TmfTraceStub)) {
return null;
}
// Highly inefficient...
RandomAccessFile stream = ((TmfTraceStub) fEventStream).getStream();
// String name = eventStream.getName();
// name = name.substring(name.lastIndexOf('/') + 1);
long location = 0;
if (context != null) {
location = (Long) context.getLocation().getLocationInfo();
}
try {
stream.seek(location);
long ts = stream.readLong();
stream.readUTF();
/* Previously source, now unused */
String type = stream.readUTF();
stream.readUTF();
/* Previously reference, now unused */
String sender = stream.readUTF();
String receiver = stream.readUTF();
String signal = stream.readUTF();
String[] labels = { "sender", "receiver", "signal" };
TmfEventType tmfEventType = new TmfEventType(type, TmfEventField.makeRoot(labels));
String content = "[";
content += sender;
content += "," + receiver;
content += "," + signal;
content += "]";
// Pre-parse the content
TmfEventField[] fields = new TmfEventField[3];
fields[0] = new TmfEventField("sender", sender, null);
fields[1] = new TmfEventField("receiver", receiver, null);
fields[2] = new TmfEventField("signal", signal, null);
ITmfEventField tmfContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, content, fields);
ITmfEvent tmfEvent = new TmfEvent(fEventStream, ITmfContext.UNKNOWN_RANK, TmfTimestamp.create(ts, -9), tmfEventType, tmfContent);
return tmfEvent;
} catch (final EOFException e) {
} catch (final IOException e) {
}
return null;
}
Aggregations