use of org.eclipse.tracecompass.internal.tmf.core.histogram.HistogramDataProvider in project tracecompass by tracecompass.
the class HistogramDataProviderTest method testHelloLost.
/**
* Test the {@link HistogramDataProvider} with the
* {@link CtfTestTrace#HELLO_LOST} trace. Ensure that the expected tree and xy
* models are returned
*
* @throws TmfAnalysisException
* if the trace is set more that once
*/
@Test
public void testHelloLost() throws TmfAnalysisException {
CtfTmfTrace trace = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.HELLO_LOST);
TmfStatisticsModule module = new TmfStatisticsModule();
module.setName("Statistics");
assertTrue("Statistics Analysis should apply to this trace", module.setTrace(trace));
assertEquals("Statistics Analysis shouls be schedulable", Status.OK_STATUS, module.schedule());
assertTrue("Statistics Analysis should run successfully", module.waitForCompletion());
try {
HistogramDataProvider provider = new HistogramDataProvider(trace, module);
TmfModelResponse<@NonNull TmfTreeModel<@NonNull TmfTreeDataModel>> treeResponse = provider.fetchTree(FetchParametersUtils.timeQueryToMap(new TimeQueryFilter(START, END, 2)), null);
assertEquals("Response Status should be COMPLETED, as we waited for the analysis to complete", ITmfResponse.Status.COMPLETED, treeResponse.getStatus());
TmfTreeModel<@NonNull TmfTreeDataModel> treeModel = treeResponse.getModel();
assertNotNull(treeModel);
assertEquals(EXPECTED_FULL_PATHS, getFullPaths(treeModel.getEntries()));
List<Long> ids = Lists.transform(treeModel.getEntries(), TmfTreeDataModel::getId);
SelectionTimeQueryFilter selectionFilter = new SelectionTimeQueryFilter(START, END, 100, ids);
TmfModelResponse<@NonNull ITmfXyModel> xyResponse = provider.fetchXY(FetchParametersUtils.selectionTimeQueryToMap(selectionFilter), null);
assertEquals("Response Status should be COMPLETED, as we waited for the analysis to complete", ITmfResponse.Status.COMPLETED, xyResponse.getStatus());
ITmfXyModel xyModel = xyResponse.getModel();
assertNotNull(xyModel);
assertEquals(EXPECTED_YDATA, Maps.uniqueIndex(xyModel.getSeriesData(), ISeriesModel::getId));
} finally {
module.dispose();
CtfTmfTestTraceUtils.dispose(CtfTestTrace.HELLO_LOST);
}
}
Aggregations