Search in sources :

Example 16 with TmfEvent

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

the class TmfEventTest method testEqualsTransivity.

@Test
public void testEqualsTransivity() {
    final ITmfEvent event1 = new TmfEvent(fEvent1);
    final ITmfEvent event2 = new TmfEvent(fEvent1);
    final ITmfEvent event3 = new TmfEvent(fEvent1);
    assertTrue("equals", event1.equals(event2));
    assertTrue("equals", event2.equals(event3));
    assertTrue("equals", event1.equals(event3));
}
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 17 with TmfEvent

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

the class TmfEventFieldTest method testNonEqualsValue.

/**
 * Test with same fields, but different values (should not be equal)
 */
@Test
public void testNonEqualsValue() {
    final String fieldName = "myfield";
    final Object value1 = new String("test-string");
    final Object value2 = new TmfEvent(null, ITmfContext.UNKNOWN_RANK, null, null, null);
    final TmfEventField[] fields = { fField1, fField2 };
    final TmfEventField field1 = new TmfEventField(fieldName, value1, fields);
    final TmfEventField field2 = new TmfEventField(fieldName, value2, fields);
    assertNotEquals(field1, field2);
    assertNotEquals(field2, field1);
}
Also used : ITmfEventField(org.eclipse.tracecompass.tmf.core.event.ITmfEventField) TmfEventField(org.eclipse.tracecompass.tmf.core.event.TmfEventField) TmfEvent(org.eclipse.tracecompass.tmf.core.event.TmfEvent) Test(org.junit.Test)

Example 18 with TmfEvent

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

the class TmfEventTest method testConstructorWithTrace.

@Test
public void testConstructorWithTrace() {
    final ITmfTrace trace = fTrace;
    final ITmfEvent event = new TmfEvent(trace, 0, fTimestamp1, fType, fContent1);
    assertNotNull("getTrace", event.getTrace());
    assertEquals("getRank", 0, event.getRank());
    assertEquals("getTimestamp", fTimestamp1, event.getTimestamp());
    assertEquals("getType", fType, event.getType());
    assertEquals("getContent", fContent1, event.getContent());
    trace.dispose();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) 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 19 with TmfEvent

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

the class TmfEventTest method testNonEqualContents.

@Test
public void testNonEqualContents() {
    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, fTimestamp1, fType, fContent2);
    assertFalse("equals", event1.equals(event2));
    assertFalse("equals", event2.equals(event1));
    event2 = new TmfEvent(null, 0, fTimestamp1, fType, null);
    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 20 with TmfEvent

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

the class TmfEventTest method testNonEqualRanks.

@Test
public void testNonEqualRanks() {
    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, 1, fTimestamp1, 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)

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