Search in sources :

Example 1 with DiskIOActivityView

use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.io.diskioactivity.DiskIOActivityView in project tracecompass by tracecompass.

the class DisksIOViewTest method testDiskView.

/**
 * Test to check the Disks IO Activity view. First, when trace opened, there
 * should not be any activity. Then, we move to a time range where there are
 * write activity. Afterward, we test the zoom
 */
@Test
public void testDiskView() {
    // Wait for analysis to finish.
    WaitUtils.waitForJobs();
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof DiskIOActivityView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    final Chart chart = getChart();
    assertNotNull(chart);
    SWTBotTreeItem[] items = getSWTBotView().bot().tree().getAllItems();
    for (SWTBotTreeItem item : items) {
        item.check();
    }
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length > 0, chart, "No data available");
    chartViewer.setNbPoints(NUMBER_OF_POINT);
    /* Initially, no disk activity */
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, WRITE_SERIES_NAME), "resources/disk/disk0-res50.json", "Chart data is not valid");
    /* Change time range where there is disks activity */
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, new TmfTimeRange(ZOOM_START_TIME, ZOOM_END_TIME)));
    fBot.waitUntil(ConditionHelpers.windowRange(new TmfTimeRange(ZOOM_START_TIME, ZOOM_END_TIME)));
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    /* Test type, style and color of series */
    verifyChartStyle();
    /* Test data model */
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, WRITE_SERIES_NAME), "resources/disk/disk1-res50.json", "Chart data is not valid");
    /* Change Zoom and number of points */
    chartViewer.setNbPoints(MORE_POINTS);
    /* Test type, style and color of series */
    verifyChartStyle();
    /* Test data model */
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, WRITE_SERIES_NAME), "resources/disk/disk2-res100.json", "Chart data is not valid");
}
Also used : DiskIOActivityView(org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.io.diskioactivity.DiskIOActivityView) IViewPart(org.eclipse.ui.IViewPart) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Chart(org.eclipse.swtchart.Chart) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Aggregations

SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)1 Chart (org.eclipse.swtchart.Chart)1 DiskIOActivityView (org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.io.diskioactivity.DiskIOActivityView)1 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)1 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)1 XYDataProviderBaseTest (org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)1 TmfCommonXAxisChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer)1 IViewPart (org.eclipse.ui.IViewPart)1 Test (org.junit.Test)1