Search in sources :

Example 1 with TmfContext

use of org.eclipse.tracecompass.tmf.core.trace.TmfContext in project tracecompass by tracecompass.

the class TimeOffsetTest method testClearOffset.

@Test
public void testClearOffset() throws TmfTraceException {
    ITmfTimestampTransform tt = TimestampTransformFactory.createWithOffset(ONE_MS);
    TimestampTransformFactory.setTimestampTransform(fResource, tt);
    TimestampTransformFactory.setTimestampTransform(fResource, null);
    ITmfTrace trace = createAndIndexTrace();
    final TmfContext context = (TmfContext) trace.seekEvent(0);
    ITmfEvent event = trace.getNext(context);
    assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
    event = trace.getNext(context);
    assertEquals("Event timestamp", 2, event.getTimestamp().getValue());
    trace.dispose();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfContext(org.eclipse.tracecompass.tmf.core.trace.TmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfTimestampTransform(org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform) Test(org.junit.Test)

Example 2 with TmfContext

use of org.eclipse.tracecompass.tmf.core.trace.TmfContext in project tracecompass by tracecompass.

the class TmfContextTest method testIncreaseRank.

@Test
public void testIncreaseRank() {
    final TmfContext context1 = new TmfContext(fContext1);
    context1.increaseRank();
    assertEquals("getRank", fRank1 + 1, context1.getRank());
    context1.increaseRank();
    assertEquals("getRank", fRank1 + 2, context1.getRank());
    context1.setRank(ITmfContext.UNKNOWN_RANK);
    context1.increaseRank();
    assertEquals("getRank", ITmfContext.UNKNOWN_RANK, context1.getRank());
    context1.increaseRank();
    assertEquals("getRank", ITmfContext.UNKNOWN_RANK, context1.getRank());
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) TmfContext(org.eclipse.tracecompass.tmf.core.trace.TmfContext) Test(org.junit.Test)

Example 3 with TmfContext

use of org.eclipse.tracecompass.tmf.core.trace.TmfContext in project tracecompass by tracecompass.

the class TmfContextTest method testTmfContextCopy.

@Test
public void testTmfContextCopy() {
    final TmfContext context1 = new TmfContext(fContext1);
    final TmfContext context2 = new TmfContext(fContext2);
    assertEquals("getLocation", fLocation1, context1.getLocation());
    assertEquals("getLocation", fLocation2, context2.getLocation());
    assertEquals("getRank", fRank1, context1.getRank());
    assertEquals("getRank", fRank2, context2.getRank());
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) TmfContext(org.eclipse.tracecompass.tmf.core.trace.TmfContext) Test(org.junit.Test)

Example 4 with TmfContext

use of org.eclipse.tracecompass.tmf.core.trace.TmfContext in project tracecompass by tracecompass.

the class TmfContextTest method testEqualsTransivity.

@Test
public void testEqualsTransivity() {
    final TmfContext context1 = new TmfContext(fContext1);
    final TmfContext context2 = new TmfContext(context1);
    final TmfContext context3 = new TmfContext(context2);
    assertTrue("equals", context1.equals(context2));
    assertTrue("equals", context2.equals(context3));
    assertTrue("equals", context1.equals(context3));
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) TmfContext(org.eclipse.tracecompass.tmf.core.trace.TmfContext) Test(org.junit.Test)

Example 5 with TmfContext

use of org.eclipse.tracecompass.tmf.core.trace.TmfContext in project tracecompass by tracecompass.

the class TmfContextTest method testEqualsSymmetry.

@Test
public void testEqualsSymmetry() {
    final TmfContext context1 = new TmfContext(fContext1);
    final TmfContext context2 = new TmfContext(fContext2);
    assertTrue("equals", context1.equals(fContext1));
    assertTrue("equals", fContext1.equals(context1));
    assertTrue("equals", context2.equals(fContext2));
    assertTrue("equals", fContext2.equals(context2));
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) TmfContext(org.eclipse.tracecompass.tmf.core.trace.TmfContext) Test(org.junit.Test)

Aggregations

TmfContext (org.eclipse.tracecompass.tmf.core.trace.TmfContext)36 ITmfContext (org.eclipse.tracecompass.tmf.core.trace.ITmfContext)27 Test (org.junit.Test)18 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)12 IOException (java.io.IOException)8 TmfLongLocation (org.eclipse.tracecompass.tmf.core.trace.location.TmfLongLocation)8 ITmfLocation (org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation)7 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)3 ArrayList (java.util.ArrayList)2 NonNull (org.eclipse.jdt.annotation.NonNull)2 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)2 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)2 DefaultCondition (org.eclipse.swtbot.swt.finder.waits.DefaultCondition)2 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)2 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)2 ITmfTimestampTransform (org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform)2 ITmfCheckpoint (org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint)2 ITmfCheckpointIndex (org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpointIndex)2 TmfTraceStub (org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub)2 Before (org.junit.Before)2