Search in sources :

Example 11 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.

the class LttngExecutionGraphTest method setUpTrace.

/**
 * Setup the trace for the tests
 *
 * @param traceFile
 *            File name relative to this plugin for the trace file to load
 * @return The trace with its graph module executed
 */
public ITmfTrace setUpTrace(String traceFile) {
    TmfXmlKernelTraceStub trace = new TmfXmlKernelTraceStub();
    IPath filePath = Activator.getAbsoluteFilePath(traceFile);
    IStatus status = trace.validate(null, filePath.toOSString());
    if (!status.isOK()) {
        fail(status.getException().getMessage());
    }
    try {
        trace.initTrace(null, filePath.toOSString(), TmfEvent.class);
    } catch (TmfTraceException e) {
        fail(e.getMessage());
    }
    trace.traceOpened(new TmfTraceOpenedSignal(this, trace, null));
    IAnalysisModule module = null;
    for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, TmfGraphBuilderModule.class)) {
        module = mod;
    }
    assertNotNull(module);
    module.schedule();
    module.waitForCompletion();
    return trace;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) TmfXmlKernelTraceStub(org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub) IPath(org.eclipse.core.runtime.IPath) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)

Example 12 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.

the class TmfEventRequestIntegrationTest method setUp.

/**
 * Test class setup
 */
@BeforeClass
public static void setUp() {
    try {
        fTrace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
        TmfSignalManager.deregister(fTrace);
        fTrace.indexTrace(true);
    } catch (final TmfTraceException e) {
        e.printStackTrace();
        fail("Error setting up test trace");
    }
}
Also used : TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) TmfTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub) BeforeClass(org.junit.BeforeClass)

Example 13 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.

the class TmfExperimentTest method setupTrace.

// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
private synchronized ITmfTrace[] setupTrace(final String path) {
    if (fTestTraces == null) {
        fTestTraces = new ITmfTrace[1];
        try {
            final TmfTraceStub trace = new TmfTraceStub(path, 0, true, null);
            fTestTraces[0] = trace;
        } catch (final TmfTraceException e) {
            e.printStackTrace();
        }
    }
    return fTestTraces;
}
Also used : TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) TmfTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub)

Example 14 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.

the class TmfTraceTest method setUp.

// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
@Before
public void setUp() {
    try {
        fTrace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
        TmfSignalManager.deregister(fTrace);
        fTrace.indexTrace(true);
    } catch (final TmfTraceException e) {
        e.printStackTrace();
    }
}
Also used : TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) TmfTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub) Before(org.junit.Before)

Example 15 with TmfTraceException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException in project tracecompass by tracecompass.

the class TmfTraceTest method testCopyConstructor.

@Test
public void testCopyConstructor() throws TmfTraceException {
    TmfTraceStub original = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
    TmfTraceStub trace = new TmfTraceStub(original);
    trace.indexTrace(true);
    assertEquals("getEventType", ITmfEvent.class, trace.getEventType());
    assertNull("getResource", trace.getResource());
    assertEquals("getPath", TEST_TRACE.getFullPath(), trace.getPath());
    assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
    assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
    assertEquals("getName", TEST_TRACE.getPath(), trace.getName());
    assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
    assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
    assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
    assertEquals("getStartTime", 1, trace.getStartTime().getValue());
    assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
    original.dispose();
    trace.dispose();
    // Test the copy of a null trace
    try {
        new TmfTraceStub((TmfTraceStub) null);
        fail("Missing exception");
    } catch (final IllegalArgumentException e) {
    // test passed
    } catch (final Exception e) {
        fail("Unexpected exception");
    }
}
Also used : TmfTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) Test(org.junit.Test)

Aggregations

TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)50 File (java.io.File)17 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)14 IStatus (org.eclipse.core.runtime.IStatus)12 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)12 TmfTraceStub (org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub)11 IOException (java.io.IOException)10 IPath (org.eclipse.core.runtime.IPath)8 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)8 TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)8 TmfXmlKernelTraceStub (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub)7 Performance (org.eclipse.test.performance.Performance)6 PerformanceMeter (org.eclipse.test.performance.PerformanceMeter)6 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)6 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)6 Before (org.junit.Before)6 LttngKernelTrace (org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace)5 CtfTmfTrace (org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4