Search in sources :

Example 1 with AnnotationCategoriesModel

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());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) AnnotationCategoriesModel(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel) ArrayList(java.util.ArrayList) TmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel) Annotation(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.Annotation) NonNull(org.eclipse.jdt.annotation.NonNull) AnnotationModel(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationModel) TmfTreeModel(org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeModel) TmfTreeCompositeDataProvider(org.eclipse.tracecompass.internal.tmf.core.model.tree.TmfTreeCompositeDataProvider) Test(org.junit.Test)

Example 2 with AnnotationCategoriesModel

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, "");
}
Also used : AnnotationCategoriesModel(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel) TmfModelResponse(org.eclipse.tracecompass.tmf.core.response.TmfModelResponse) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)

Example 3 with AnnotationCategoriesModel

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());
}
Also used : AnnotationCategoriesModel(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel)

Example 4 with AnnotationCategoriesModel

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());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) PeriodicAnnotationProvider(org.eclipse.tracecompass.internal.tmf.core.annotations.PeriodicAnnotationProvider) AnnotationCategoriesModel(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel) IOutputAnnotationProvider(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.IOutputAnnotationProvider) Test(org.junit.Test)

Example 5 with AnnotationCategoriesModel

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);
}
Also used : AnnotationCategoriesModel(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel) IOutputAnnotationProvider(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.IOutputAnnotationProvider) TmfModelResponse(org.eclipse.tracecompass.tmf.core.response.TmfModelResponse)

Aggregations

AnnotationCategoriesModel (org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationCategoriesModel)7 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 NonNull (org.eclipse.jdt.annotation.NonNull)3 IOutputAnnotationProvider (org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.IOutputAnnotationProvider)3 TmfModelResponse (org.eclipse.tracecompass.tmf.core.response.TmfModelResponse)3 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 LinkedHashSet (java.util.LinkedHashSet)1 Annotation (org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.Annotation)1 AnnotationModel (org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.AnnotationModel)1 PeriodicAnnotationProvider (org.eclipse.tracecompass.internal.tmf.core.annotations.PeriodicAnnotationProvider)1 TmfTreeCompositeDataProvider (org.eclipse.tracecompass.internal.tmf.core.model.tree.TmfTreeCompositeDataProvider)1 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)1 ITimeGraphDataProvider (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphDataProvider)1 TimeGraphEntryModel (org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel)1 TmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel)1 TmfTreeModel (org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeModel)1