use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.
the class XmlTimeGraphDataProviderTest method testNoParentDisplay.
/**
* Test getting the XML data provider for one trace, with an analysis that
* applies to a trace
*
* @throws IOException
* Exception thrown by analyses
*/
@Test
public void testNoParentDisplay() throws IOException {
ITmfTrace trace = getTrace();
assertNotNull(trace);
try {
runModule(trace);
// Get the view element from the file
Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.TIME_GRAPH_VIEW, TIME_GRAPH_VIEW_ID2);
assertNotNull(viewElement);
ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> timeGraphProvider = XmlDataProviderManager.getInstance().getTimeGraphProvider(trace, viewElement);
assertNotNull(timeGraphProvider);
List<String> expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedTimeGraphTree"));
Map<Long, String> tree = assertAndGetTree(timeGraphProvider, trace, expectedStrings);
expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedTimeGraphRows"));
// The CPU entry does not have entries
expectedStrings.remove(0);
assertRows(timeGraphProvider, tree, expectedStrings);
} finally {
trace.dispose();
TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.
the class XmlTimeGraphDataProviderTest method testFactory.
/**
* Test the {@link DataDrivenTimeGraphProviderFactory} class
*/
@Test
public void testFactory() {
ITmfTrace trace = getTrace();
assertNotNull(trace);
try {
runModule(trace);
// Get the view element from the file
Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.TIME_GRAPH_VIEW, TIME_GRAPH_VIEW_ID);
assertNotNull(viewElement);
TmfXmlTimeGraphViewCu tgViewCu = TmfXmlTimeGraphViewCu.compile(new AnalysisCompilationData(), viewElement);
assertNotNull(tgViewCu);
DataDrivenTimeGraphProviderFactory timeGraphFactory = tgViewCu.generate();
// Test the factory with a simple trace
ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> provider = timeGraphFactory.create(trace);
assertNotNull(provider);
assertEquals(DataDrivenTimeGraphDataProvider.ID, provider.getId());
// Test the factory with an ID and state system
ITmfAnalysisModuleWithStateSystems module = TmfTraceUtils.getAnalysisModuleOfClass(trace, ITmfAnalysisModuleWithStateSystems.class, ANALYSIS_ID);
assertNotNull(module);
Iterable<@NonNull ITmfStateSystem> stateSystems = module.getStateSystems();
assertNotNull(stateSystems);
provider = DataDrivenTimeGraphProviderFactory.create(trace, Objects.requireNonNull(Lists.newArrayList(stateSystems)), getEntries(new AnalysisCompilationData(), viewElement), getvalues(viewElement), ANALYSIS_ID);
assertNotNull(provider);
assertEquals(ANALYSIS_ID, provider.getId());
} finally {
trace.dispose();
TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.
the class XmlXyDataProviderTest method testXYFactory.
/**
* Test the {@link DataDrivenXYProviderFactory} class
*/
@Test
public void testXYFactory() {
ITmfTrace trace = getTrace();
assertNotNull(trace);
try {
runModule(trace);
// Get the view element from the file
Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.XY_VIEW, XY_VIEW_ID_DELTA);
assertNotNull(viewElement);
TmfXmlXYViewCu tgViewCu = TmfXmlXYViewCu.compile(new AnalysisCompilationData(), viewElement);
assertNotNull(tgViewCu);
DataDrivenXYProviderFactory XYFactory = tgViewCu.generate();
// Test the factory with a simple trace
ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> provider = XYFactory.create(trace);
assertNotNull(provider);
assertEquals(DataDrivenXYDataProvider.ID, provider.getId());
// Test the factory with an ID and state system
ITmfAnalysisModuleWithStateSystems module = TmfTraceUtils.getAnalysisModuleOfClass(trace, ITmfAnalysisModuleWithStateSystems.class, ANALYSIS_ID);
assertNotNull(module);
Iterable<@NonNull ITmfStateSystem> stateSystems = module.getStateSystems();
assertNotNull(stateSystems);
provider = DataDrivenXYProviderFactory.create(trace, Objects.requireNonNull(Lists.newArrayList(stateSystems)), getEntries(new AnalysisCompilationData(), viewElement), ANALYSIS_ID);
assertNotNull(provider);
assertEquals(ANALYSIS_ID, provider.getId());
} finally {
trace.dispose();
TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.
the class XmlXyDataProviderTest method testXYDataProviderDelta.
/**
* Test getting the XML XY data provider for one trace, with an analysis that
* applies to a trace, and requesting relative values (delta) for the y axis.
*
* @throws IOException
* Exception thrown by analyses
*/
@Test
public void testXYDataProviderDelta() throws IOException {
ITmfTrace trace = getTrace();
assertNotNull(trace);
try {
runModule(trace);
// Get the view element from the file
Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.XY_VIEW, XY_VIEW_ID_DELTA);
assertNotNull(viewElement);
ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> xyProvider = XmlDataProviderManager.getInstance().getXyProvider(trace, viewElement);
assertNotNull(xyProvider);
List<String> expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedXYTree"));
Map<Long, String> tree = assertAndGetTree(xyProvider, trace, expectedStrings);
expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedXYDataDelta"));
assertRows(xyProvider, tree, expectedStrings);
} finally {
trace.dispose();
TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.
the class XmlXyDataProviderTest method testXYDataProvider.
/**
* Test getting the XML data provider for one trace, with an analysis that
* applies to a trace
*
* @throws IOException
* Exception thrown by analyses
*/
@Test
public void testXYDataProvider() throws IOException {
ITmfTrace trace = getTrace();
assertNotNull(trace);
try {
runModule(trace);
// Get the view element from the file
Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.XY_VIEW, XY_VIEW_ID);
assertNotNull(viewElement);
ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> xyProvider = XmlDataProviderManager.getInstance().getXyProvider(trace, viewElement);
assertNotNull(xyProvider);
List<String> expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedXYTree"));
Map<Long, String> tree = assertAndGetTree(xyProvider, trace, expectedStrings);
expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedXYData"));
assertRows(xyProvider, tree, expectedStrings);
} finally {
trace.dispose();
TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
}
}
Aggregations