use of org.eclipse.tracecompass.internal.tmf.core.model.tree.TmfTreeCompositeDataProvider in project tracecompass by tracecompass.
the class TmfTreeDataModelTest method testCompositeTree.
/**
* Test {@link TmfTreeCompositeDataProvider}
*/
@Test
public void testCompositeTree() {
List<DummyDataProvider> ddps = new ArrayList<>();
for (int i = 0; i < 3; i++) {
ddps.add(new DummyDataProvider(i));
}
TmfTreeCompositeDataProvider<@NonNull TmfTreeDataModel, @NonNull DummyDataProvider> composite = new TmfTreeCompositeDataProvider<>(ddps, "composite-dummy");
assertNotNull(composite);
NullProgressMonitor monitor = new NullProgressMonitor();
TmfModelResponse<@NonNull TmfTreeModel<@NonNull TmfTreeDataModel>> tree = composite.fetchTree(Collections.emptyMap(), monitor);
TmfTreeModel<@NonNull TmfTreeDataModel> model = tree.getModel();
assertNotNull(model);
assertEquals(Arrays.asList("header"), model.getHeaders());
assertEquals(3, model.getEntries().size());
// AnnotationCategories
TmfModelResponse<@NonNull AnnotationCategoriesModel> returnVal = composite.fetchAnnotationCategories(Collections.emptyMap(), monitor);
AnnotationCategoriesModel categoryModel = returnVal.getModel();
assertNotNull(categoryModel);
assertEquals(Arrays.asList("common", "0", "1", "2"), categoryModel.getAnnotationCategories());
// Annotations
TmfModelResponse<@NonNull AnnotationModel> annotations = composite.fetchAnnotations(Collections.emptyMap(), monitor);
AnnotationModel annotationsModel = annotations.getModel();
assertNotNull(annotationsModel);
Collection<@NonNull Annotation> collection = annotationsModel.getAnnotations().get("test");
assertNotNull(collection);
assertEquals(6, collection.size());
}
Aggregations