Search in sources :

Example 6 with TmfEvent

use of org.eclipse.tracecompass.tmf.core.event.TmfEvent in project tracecompass by tracecompass.

the class TmfEventTest method testNonEqualTypes.

@Test
public void testNonEqualTypes() {
    final ITmfEvent event1 = new TmfEvent(null, 0, fTimestamp1, fType, fContent1);
    ITmfEvent event2 = new TmfEvent(null, 0, fTimestamp1, fType, fContent1);
    assertTrue("equals", event1.equals(event2));
    assertTrue("equals", event2.equals(event1));
    final String typeId = "OtherTestType";
    final String[] labels = new String[] { fLabel2, fLabel1 };
    final TmfEventType newType = new TmfEventType(typeId, TmfEventField.makeRoot(labels));
    event2 = new TmfEvent(null, 0, fTimestamp1, newType, fContent1);
    assertFalse("equals", event1.equals(event2));
    assertFalse("equals", event2.equals(event1));
    event2 = new TmfEvent(null, 0, fTimestamp1, null, fContent1);
    assertFalse("equals", event1.equals(event2));
    assertFalse("equals", event2.equals(event1));
}
Also used : TmfEvent(org.eclipse.tracecompass.tmf.core.event.TmfEvent) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfEventType(org.eclipse.tracecompass.tmf.core.event.TmfEventType) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) Test(org.junit.Test)

Example 7 with TmfEvent

use of org.eclipse.tracecompass.tmf.core.event.TmfEvent in project tracecompass by tracecompass.

the class TmfEventTest method testNonEqualTimestamps.

@Test
public void testNonEqualTimestamps() {
    final ITmfEvent event1 = new TmfEvent(null, 0, fTimestamp1, fType, fContent1);
    ITmfEvent event2 = new TmfEvent(null, 0, fTimestamp1, fType, fContent1);
    assertTrue("equals", event1.equals(event2));
    assertTrue("equals", event2.equals(event1));
    event2 = new TmfEvent(null, 0, fTimestamp2, fType, fContent1);
    assertFalse("equals", event1.equals(event2));
    assertFalse("equals", event2.equals(event1));
    event2 = new TmfEvent(null, 0, null, fType, fContent1);
    assertFalse("equals", event1.equals(event2));
    assertFalse("equals", event2.equals(event1));
}
Also used : TmfEvent(org.eclipse.tracecompass.tmf.core.event.TmfEvent) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) Test(org.junit.Test)

Example 8 with TmfEvent

use of org.eclipse.tracecompass.tmf.core.event.TmfEvent 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());
}
Also used : TmfEvent(org.eclipse.tracecompass.tmf.core.event.TmfEvent) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) Test(org.junit.Test)

Example 9 with TmfEvent

use of org.eclipse.tracecompass.tmf.core.event.TmfEvent 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());
}
Also used : TmfEvent(org.eclipse.tracecompass.tmf.core.event.TmfEvent) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) Test(org.junit.Test)

Example 10 with TmfEvent

use of org.eclipse.tracecompass.tmf.core.event.TmfEvent 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());
}
Also used : TmfEvent(org.eclipse.tracecompass.tmf.core.event.TmfEvent) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) Test(org.junit.Test)

Aggregations

TmfEvent (org.eclipse.tracecompass.tmf.core.event.TmfEvent)21 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)19 Test (org.junit.Test)16 ITmfEventField (org.eclipse.tracecompass.tmf.core.event.ITmfEventField)5 TmfEventField (org.eclipse.tracecompass.tmf.core.event.TmfEventField)5 TmfEventType (org.eclipse.tracecompass.tmf.core.event.TmfEventType)5 IOException (java.io.IOException)3 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)3 EOFException (java.io.EOFException)2 RandomAccessFile (java.io.RandomAccessFile)2 ITmfEventType (org.eclipse.tracecompass.tmf.core.event.ITmfEventType)2 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 NonNull (org.eclipse.jdt.annotation.NonNull)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 ITmfStateValue (org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue)1 CustomEventContent (org.eclipse.tracecompass.tmf.core.parsers.custom.CustomEventContent)1 CustomXmlEvent (org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlEvent)1 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)1 ITmfContext (org.eclipse.tracecompass.tmf.core.trace.ITmfContext)1