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;
}
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");
}
}
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;
}
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();
}
}
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");
}
}
Aggregations