use of org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel 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());
}
use of org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel in project tracecompass by tracecompass.
the class LostEventsOutputAnnotationProvider method fetchAnnotationCategories.
@Override
public TmfModelResponse<AnnotationCategoriesModel> fetchAnnotationCategories(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
AnnotationCategoriesModel model = new AnnotationCategoriesModel(Collections.emptyList());
ITmfStateSystem ss = getStateSystem();
if (ss != null && getLostEventsQuark(ss) != -1) {
model = new AnnotationCategoriesModel(Arrays.asList(LOST_EVENTS));
}
// $NON-NLS-1$
return new TmfModelResponse<>(model, Status.COMPLETED, "");
}
use of org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel in project tracecompass by tracecompass.
the class CustomAnnotationProviderTest method assertAnnotationCategoriesModelResponse.
private static void assertAnnotationCategoriesModelResponse(List<String> expectedCategories, TmfModelResponse<AnnotationCategoriesModel> response) {
assertEquals(Status.COMPLETED, response.getStatus());
AnnotationCategoriesModel model = response.getModel();
assertNotNull(model);
assertEquals(expectedCategories, model.getAnnotationCategories());
}
use of org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel in project tracecompass by tracecompass.
the class PeriodicAnnotationProviderTest method testCategories.
/**
* Test fetching the annotation categories
*/
@Test
public void testCategories() {
IOutputAnnotationProvider provider = new PeriodicAnnotationProvider(CATEGORY, ITimeReference.ZERO, 100L, 0, COLOR, null);
TmfModelResponse<@NonNull AnnotationCategoriesModel> response = provider.fetchAnnotationCategories(Collections.emptyMap(), new NullProgressMonitor());
assertEquals(Status.COMPLETED, response.getStatus());
AnnotationCategoriesModel model = response.getModel();
assertNotNull(model);
assertEquals(Arrays.asList(CATEGORY), model.getAnnotationCategories());
}
use of org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel in project tracecompass by tracecompass.
the class TmfTreeCompositeDataProvider method fetchAnnotationCategories.
@Override
public TmfModelResponse<AnnotationCategoriesModel> fetchAnnotationCategories(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
AnnotationCategoriesModel model = new AnnotationCategoriesModel(Collections.emptyList());
for (P dataProvider : getProviders()) {
if (dataProvider instanceof IOutputAnnotationProvider) {
TmfModelResponse<AnnotationCategoriesModel> response = ((IOutputAnnotationProvider) dataProvider).fetchAnnotationCategories(fetchParameters, monitor);
model = AnnotationCategoriesModel.of(model, response.getModel());
}
}
if (model.getAnnotationCategories().isEmpty()) {
return new TmfModelResponse<>(null, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
return new TmfModelResponse<>(model, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
Aggregations