use of org.eclipse.tracecompass.internal.tmf.core.model.timegraph.TmfTimeGraphCompositeDataProvider in project tracecompass by tracecompass.
the class XmlDataProviderManagerTest method testExperimentWithTraceAnalysis.
/**
* Test getting the XML data provider for an experiment, with an analysis that
* applies to a trace
*/
@Test
public void testExperimentWithTraceAnalysis() {
ITmfTrace trace = null;
ITmfTrace trace2 = null;
ITmfTrace experiment = null;
try {
// Initialize the trace and module
trace = XmlUtilsTest.initializeTrace(TEST_TRACE);
trace2 = XmlUtilsTest.initializeTrace(TEST_TRACE2);
ITmfTrace[] traces = { trace, trace2 };
experiment = new TmfExperiment(ITmfEvent.class, "Xml Experiment", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
TmfTraceOpenedSignal signal = new TmfTraceOpenedSignal(this, experiment, null);
((TmfTrace) trace).traceOpened(signal);
((TmfTrace) trace2).traceOpened(signal);
((TmfTrace) experiment).traceOpened(signal);
// The data provider manager uses opened traces from the manager
TmfTraceManager.getInstance().traceOpened(signal);
Iterable<@NonNull DataDrivenAnalysisModule> modules = TmfTraceUtils.getAnalysisModulesOfClass(experiment, DataDrivenAnalysisModule.class);
modules.forEach(module -> {
module.schedule();
assertTrue(module.waitForCompletion());
});
// Get the view element from the file
Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.STATE_VALUE_FILE.getPath().toOSString(), TmfXmlStrings.TIME_GRAPH_VIEW, TRACE_VIEW_ID);
assertNotNull(viewElement);
ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> timeGraphProvider = XmlDataProviderManager.getInstance().getTimeGraphProvider(experiment, viewElement);
assertNotNull(timeGraphProvider);
assertTrue(timeGraphProvider instanceof TmfTimeGraphCompositeDataProvider);
} finally {
if (trace != null) {
trace.dispose();
}
if (trace2 != null) {
trace2.dispose();
}
if (experiment != null) {
experiment.dispose();
TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, experiment));
}
}
}
use of org.eclipse.tracecompass.internal.tmf.core.model.timegraph.TmfTimeGraphCompositeDataProvider in project tracecompass by tracecompass.
the class XmlDataProviderManagerTest method testExperiment.
/**
* Test getting the XML data provider for an experiment, with an analysis that
* applies to an experiment
*/
@Test
public void testExperiment() {
ITmfTrace trace = null;
ITmfTrace trace2 = null;
ITmfTrace experiment = null;
try {
// Initialize the trace and module
trace = XmlUtilsTest.initializeTrace(TEST_TRACE);
trace2 = XmlUtilsTest.initializeTrace(TEST_TRACE2);
ITmfTrace[] traces = { trace, trace2 };
experiment = new TmfExperiment(ITmfEvent.class, "Xml Experiment", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
TmfTraceOpenedSignal signal = new TmfTraceOpenedSignal(this, experiment, null);
((TmfTrace) trace).traceOpened(signal);
((TmfTrace) trace2).traceOpened(signal);
((TmfTrace) experiment).traceOpened(signal);
// The data provider manager uses opened traces from the manager
TmfTraceManager.getInstance().traceOpened(signal);
Iterable<@NonNull DataDrivenAnalysisModule> modules = TmfTraceUtils.getAnalysisModulesOfClass(experiment, DataDrivenAnalysisModule.class);
modules.forEach(module -> {
module.schedule();
assertTrue(module.waitForCompletion());
});
// Get the view element from the file
Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.EXPERIMENT.getPath().toOSString(), TmfXmlStrings.TIME_GRAPH_VIEW, EXPERIMENT_VIEW_ID);
assertNotNull(viewElement);
ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> timeGraphProvider = XmlDataProviderManager.getInstance().getTimeGraphProvider(experiment, viewElement);
assertNotNull(timeGraphProvider);
assertFalse(timeGraphProvider instanceof TmfTimeGraphCompositeDataProvider);
} finally {
if (trace != null) {
trace.dispose();
}
if (trace2 != null) {
trace2.dispose();
}
if (experiment != null) {
experiment.dispose();
TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, experiment));
}
}
}
Aggregations