Search in sources :

Example 1 with CtfTmfEventFactory

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

the class CtfTmfCpuAspectTest method test.

/**
 * Test the cpu aspect
 */
@Test
public void test() {
    CtfCpuAspect fixture = new CtfCpuAspect();
    CtfTmfTrace trace = fTrace;
    assertNotNull(trace);
    CtfTmfEventFactory fabrica = CtfTmfEventFactory.instance();
    /*
         * Evaluate field, no stream
         */
    CtfTmfEvent e = fabrica.createEvent(trace, fEvents.get(0), "");
    assertEquals(Integer.valueOf(2), fixture.resolve(e));
    /*
         * Evaluate stream and field
         */
    e = fabrica.createEvent(trace, fEvents.get(1), "");
    assertEquals(Integer.valueOf(3), fixture.resolve(e));
    /*
         * Evaluate context
         */
    e = fabrica.createEvent(trace, fEvents.get(2), "");
    assertNull(fixture.resolve(e));
    /*
         * Evaluate an empty event
         */
    e = fabrica.createEvent(trace, fEvents.get(3), "");
    assertNull(fixture.resolve(e));
    /*
         * Evaluate stream and no field, default LTTng behaviour
         */
    e = fabrica.createEvent(trace, fEvents.get(4), "");
    assertEquals(Integer.valueOf(6), fixture.resolve(e));
    /*
         * Evaluate non-ctf event
         */
    assertNull(fixture.resolve(new TmfEvent(trace, 0, TmfTimestamp.BIG_BANG, null, null)));
}
Also used : CtfTmfEvent(org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent) TmfEvent(org.eclipse.tracecompass.tmf.core.event.TmfEvent) CtfTmfEvent(org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent) CtfCpuAspect(org.eclipse.tracecompass.tmf.ctf.core.event.aspect.CtfCpuAspect) CtfTmfEventFactory(org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventFactory) CtfTmfTrace(org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace) Test(org.junit.Test)

Aggregations

TmfEvent (org.eclipse.tracecompass.tmf.core.event.TmfEvent)1 CtfTmfEvent (org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent)1 CtfTmfEventFactory (org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventFactory)1 CtfCpuAspect (org.eclipse.tracecompass.tmf.ctf.core.event.aspect.CtfCpuAspect)1 CtfTmfTrace (org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)1 Test (org.junit.Test)1