Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem#check()

The following examples show how to use org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem#check() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PatternScatterChartViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test the pattern latency scatter graph. This method test if the chart has one
 * series and the series has data
 */
@Test
public void testWithTrace() {

    // Get the chart viewer and wait for the view to be ready
    WaitUtils.waitForJobs();
    TmfXYChartViewer chartViewer = getChartViewer();
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    // Check all the items in the tree
    final Chart chart = fScatterChart;
    assertNotNull(chart);
    SWTBotView viewBot = fBot.viewById(VIEW_ID);
    SWTBotTreeItem[] items = viewBot.bot().tree().getAllItems();
    for (SWTBotTreeItem item : items) {
        item.check();
    }

    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length > 0, chart, "No data available");

    // Look at the presence of data in the chart
    SWTBotChart chartBot = new SWTBotChart(chart);
    assertVisible(chartBot);
    final Range range = chart.getAxisSet().getXAxes()[0].getRange();
    assertEquals(100000000, range.upper - range.lower, 0);
    ISeriesSet seriesSet = fScatterChart.getSeriesSet();
    assertNotNull(seriesSet);
    ISeries<?>[] series = seriesSet.getSeries();
    assertNotNull(series);

    // Verify that the chart has more than 1 series
    assertTrue(series.length > 1);
    // Verify that each series has data
    for (int i = 0; i < series.length; i++) {
        assertTrue("Verifying series " + i, series[i].getXSeries().length > 0);
    }
}
 
Example 2
Source File: SWTBotImportWizardUtils.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * While in the import wizard, select an item in the file selection control.
 * The item can be a folder in the left tree or a file in the right table.
 * The item will be checked.
 *
 * @param bot
 *            the SWTBot
 * @param treePath
 *            the path to the item, ending with a file or folder
 */
public static void selectItem(SWTBot bot, String... treePath) {
    SWTBotTree tree = bot.tree();
    bot.waitUntil(Conditions.widgetIsEnabled(tree));
    if (treePath.length == 0) {
        return;
    }
    if (treePath.length == 1) {
        SWTBotTreeItem rootNode = SWTBotUtils.getTreeItem(bot, tree, treePath);
        rootNode.select();
        rootNode.check();
        return;
    }
    String[] parentPath = Arrays.copyOf(treePath, treePath.length - 1);
    String itemName = treePath[treePath.length - 1];
    SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(bot, tree, parentPath);
    folderNode.expand();
    if (folderNode.getNodes().contains(itemName)) {
        folderNode = folderNode.getNode(itemName);
        folderNode.select();
        folderNode.check();
    } else {
        folderNode.select();
        SWTBotTable fileTable = bot.table();
        bot.waitUntil(Conditions.widgetIsEnabled(fileTable));
        bot.waitUntil(ConditionHelpers.isTableItemAvailable(itemName, fileTable));
        SWTBotTableItem tableItem = fileTable.getTableItem(itemName);
        tableItem.check();
    }
}
 
Example 3
Source File: CounterViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Ensure the data displayed in the chart viewer reflects the tree viewer's
 * selected entries.
 */
@Test
public void testManipulatingTreeViewer() {
    final Chart chart = getChart();
    assertNotNull(chart);
    assertEquals(0, chart.getSeriesSet().getSeries().length);

    SWTBotTree treeBot = getSWTBotView().bot().tree();
    WaitUtils.waitUntil(tree -> tree.rowCount() >= 1, treeBot, "The tree viewer did not finish loading.");
    SWTBotTreeItem root = treeBot.getTreeItem(TRACE_NAME);
    assertNotNull(root);
    SWTBotTreeItem counter = retrieveTreeItem(root, COUNTER_NAME);
    assertNotNull(counter);

    // Check all elements of the tree
    root.check();
    WaitUtils.waitUntil(SWTBotTreeItem::isChecked, root, "Root entry was not checked");
    assertTrue(counter.isChecked());
    assertFalse(root.isGrayed());
    assertFalse(counter.isGrayed());
    WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 3, chart, "The data series did not load.");

    // Uncheck a leaf of the tree
    counter.uncheck();
    assertTrue(root.isChecked());
    assertTrue(root.isGrayed());
    assertFalse(counter.isChecked());
    assertFalse(counter.isGrayed());
    WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart,
            "A data series has not been removed.");
}
 
Example 4
Source File: CounterViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Validate the Counters view data model.
 */
@Test
public void testDisplayingDataSeries() {
    // Setup the chart viewer
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof CounterView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    chartViewer.setNbPoints(NUMBER_OF_POINTS);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    final Chart chart = getChart();
    assertNotNull(chart);
    assertEquals(0, chart.getSeriesSet().getSeries().length);

    // Check the counter entry
    SWTBotTree treeBot = getSWTBotView().bot().tree();
    WaitUtils.waitUntil(tree -> tree.rowCount() >= 1, treeBot, "The tree viewer did not finish loading.");
    SWTBotTreeItem root = treeBot.getTreeItem(TRACE_NAME);
    SWTBotTreeItem counter = retrieveTreeItem(root, COUNTER_NAME);
    assertNotNull(counter);
    counter.check();
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 1, chart, "The data series did not load.");

    // Ensure the data series has the correct styling
    verifySeriesStyle(MAIN_SERIES_NAME, ISeries.SeriesType.LINE, BLUE, LineStyle.SOLID, false);

    // Ensure the data model is valid
    WaitUtils.waitUntil(json -> isChartDataValid(chart, json, MAIN_SERIES_NAME),
            "resources/minor_faults-res50.json", "The chart data is not valid.");
}
 
Example 5
Source File: NewCounterViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Ensure the data displayed in the chart viewer reflects the tree viewer's
 * selected entries.
 */
@Test
public void testManipulatingTreeViewer() {
    final Chart chart = getChart();
    assertNotNull(chart);
    assertEquals(0, chart.getSeriesSet().getSeries().length);

    SWTBotTree treeBot = getSWTBotView().bot().tree();
    WaitUtils.waitUntil(tree -> tree.rowCount() >= 1, treeBot, "The tree viewer did not finish loading.");
    SWTBotTreeItem root = treeBot.getTreeItem(TRACE_NAME);
    assertNotNull(root);
    SWTBotTreeItem counter = retrieveTreeItem(root, COUNTER_NAME);
    assertNotNull(counter);

    // Check all elements of the tree
    root.check();
    WaitUtils.waitUntil(SWTBotTreeItem::isChecked, root, "Root entry was not checked");
    assertTrue(counter.isChecked());
    assertFalse(root.isGrayed());
    assertFalse(counter.isGrayed());
    WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 3, chart, "The data series did not load.");

    // Uncheck a leaf of the tree
    counter.uncheck();
    assertTrue(root.isChecked());
    assertTrue(root.isGrayed());
    assertFalse(counter.isChecked());
    assertFalse(counter.isGrayed());
    WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart,
            "A data series has not been removed.");
}
 
Example 6
Source File: NewCounterViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Validate the Counters view data model.
 */
@Test
public void testDisplayingDataSeries() {
    // Setup the chart viewer
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof CounterView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    chartViewer.setNbPoints(NUMBER_OF_POINTS);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    final Chart chart = getChart();
    assertNotNull(chart);
    assertEquals(0, chart.getSeriesSet().getSeries().length);

    // Check the counter entry
    SWTBotTree treeBot = getSWTBotView().bot().tree();
    WaitUtils.waitUntil(tree -> tree.rowCount() >= 1, treeBot, "The tree viewer did not finish loading.");
    SWTBotTreeItem root = treeBot.getTreeItem(TRACE_NAME);
    SWTBotTreeItem counter = retrieveTreeItem(root, COUNTER_NAME);
    assertNotNull(counter);
    counter.check();
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 1, chart, "The data series did not load.");

    // Ensure the data series has the correct styling
    verifySeriesStyle(MAIN_SERIES_NAME, ISeries.SeriesType.LINE, BLUE, LineStyle.SOLID, false);

    // Ensure the data model is valid
    WaitUtils.waitUntil(json -> isChartDataValid(chart, json, MAIN_SERIES_NAME),
            "resources/minor_faults-res50.json", "The chart data is not valid.");
}
 
Example 7
Source File: CountersViewBenchmark.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void prepareView(SWTBotView view) {
    SWTBotTree tree = view.bot().tree();
    for (SWTBotTreeItem item : tree.getAllItems()) {
        item.check();
    }
}
 
Example 8
Source File: SystemCallLatencyScatterChartViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test to check the System Call Scatter view. When trace opens, there are a few
 * syscalls present, then we move to the zone without system calls, the tree
 * should be empty.
 *
 * TODO: Test the data
 */
@Test
public void testWithTrace() {
    // Wait for analysis to finish.
    WaitUtils.waitForJobs();
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof SystemCallLatencyScatterView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    final Chart chart = getChart();
    assertNotNull(chart);
    SWTBotUtils.waitUntil(bot -> bot.tree().visibleRowCount() >= 25, getSWTBotView().bot(), "Missing rows, expected 25, was " + getSWTBotView().bot().tree().visibleRowCount());
    SWTBotTreeItem[] items = getSWTBotView().bot().tree().getAllItems();
    for (SWTBotTreeItem item : items) {
        item.check();
    }

    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 24, chart, "No data available");

    /* Test type, style and color of series */
    verifyChartStyle();

    // Update the time range to a range where there is no data
    long noDataStart = 1412670961274443542L;
    long noDataEnd = 1412670961298823940L;
    TmfTimeRange windowRange = new TmfTimeRange(TmfTimestamp.fromNanos(noDataStart), TmfTimestamp.fromNanos(noDataEnd));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, windowRange));
    fBot.waitUntil(ConditionHelpers.windowRange(windowRange));
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    // Only the root item should be present
    items = getSWTBotView().bot().tree().getAllItems();
    assertEquals(1, items.length);
}
 
Example 9
Source File: MemoryUsageViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Ensure that the tree is loaded and then check all entries
 */
private void checkAllEntries() {
    SWTBot bot = getSWTBotView().bot();

    SWTBotUtils.waitUntil(b -> b.tree().visibleRowCount() == 5, bot,
            "Incorrect number of tree entries, expected 5, was " + bot.tree().visibleRowCount());

    for (SWTBotTreeItem entry : bot.tree().getAllItems()) {
        entry.check();
    }
}
 
Example 10
Source File: DisksIOViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * 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");
}
 
Example 11
Source File: KernelMemoryUsageViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Simple test to check the Kernel Memory Usage view data model
 */
@Test
public void testKernelMemoryView() {
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof KernelMemoryUsageView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    final Chart chart = getChart();
    assertNotNull(chart);
    chartViewer.setNbPoints(NUMBER_OF_POINT);

    SWTBotTree treeBot = getSWTBotView().bot().tree();
    SWTBotTreeItem totalNode = treeBot.getTreeItem(fTraceName);
    SWTBotUtils.waitUntil(root -> root.getItems().length >= 5, totalNode, "Did not finish loading");

    /*
     * Select the total entry, which should be the first entry with an empty pid
     * column.
     */
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 1, chart, "No data available");

    /* Test type, style and color of series */
    verifySeriesStyle(TOTAL_PID, ISeries.SeriesType.LINE, BLUE, LineStyle.SOLID, false);

    /* Test data model*/
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json), "resources/kernelmemory/kernel-memory-res50.json", "Chart data is not valid");

    /*
     * Select a thread
     */
    SWTBotTreeItem sessiondEntry = totalNode.getNode("lttng-sessiond");
    sessiondEntry.check();
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");

    /* Test type, style and color of series */
    verifySeriesStyle(SESSIOND_PID, ISeries.SeriesType.LINE, RED, LineStyle.SOLID, false);

    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, SESSIOND_PID), "resources/kernelmemory/kernel-memory-res50Selected.json", "Chart data is not valid");

    /*
     * Select an another thread and change zoom
     */
    SWTBotTreeItem consumerdEntry = totalNode.getNode("lttng-consumerd");
    consumerdEntry.check();
    chartViewer.setNbPoints(MORE_POINTS);
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 3, chart, "Only total and sessiond available");

    /* Test type, style and color of series */
    verifySeriesStyle(CONSUMERD_PID, ISeries.SeriesType.LINE, GREEN, LineStyle.SOLID, false);

    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, CONSUMERD_PID), "resources/kernelmemory/kernel-memory-res100Selected.json", "Chart data is not valid");
}
 
Example 12
Source File: ResourcesAndCpuViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Simple test to check the CPU Usage view after getting signals.
 */
@Test
public void testCpuView() {
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof CpuUsageView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    final Chart chart = getChart();
    assertNotNull(chart);

    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length > 0, chart, "No data available");
    chartViewer.setNbPoints(10);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    /* Test data model */
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json), "resources/cpuusage/cpu-usage-res10.json", "Chart data is not valid");

    /* Test chart style */
    verifySeriesStyle(TOTAL_SERIES_NAME, ISeries.SeriesType.LINE, BLUE, LineStyle.SOLID, false);

    /* Select a thread */
    SWTBotTreeItem rootEntry = getSWTBotView().bot().tree().getTreeItem(TRACE_NAME);
    SWTBotUtils.waitUntil(tree -> getTableCount() >= 8, rootEntry, "Did not finish loading");
    SWTBotTreeItem selectedTheadNode = rootEntry.getNode(SELECTED_THREAD);
    selectedTheadNode.check();
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");

    /* Test data model */
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, SELECTED_THREAD_SERIES), "resources/cpuusage/cpu-usage-res10Selected.json", "Chart data is not valid");

    /* Test chart style */
    verifySeriesStyle(SELECTED_THREAD_SERIES, ISeries.SeriesType.LINE, RED, LineStyle.SOLID, true);
    selectedTheadNode.uncheck();

    /* Selected an another thread and test in HD */
    String otherSelectedThread = "lttng-consumerd";
    SWTBotTreeItem otherSelectedThreadNode = rootEntry.getNode(otherSelectedThread);
    otherSelectedThreadNode.check();
    chartViewer.setNbPoints(100);
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    /* Test data model */
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, OTHERTHREAD_SERIES), "resources/cpuusage/cpu-usage-res100Selected.json", "Chart data is not valid");

    /* Test chart style */
    verifySeriesStyle(OTHERTHREAD_SERIES, ISeries.SeriesType.LINE, GREEN, LineStyle.SOLID, true);

    /*
     * Test new TimeRange
     */
    chartViewer.setNbPoints(10);
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace();
    assertNotNull(activeTrace);
    fResourcesViewBot.getToolbarButtons().stream().filter(button -> button.getToolTipText().contains(RESET)).findAny().get().click();
    fBot.waitUntil(ConditionHelpers.windowRange(new TmfTimeRange(TRACE_START, TRACE_END)));
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));

    /* Test data model */
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, OTHERTHREAD_SERIES), "resources/cpuusage/cpu-usage-all-res10.json", "Chart data is not valid");

    /* Test chart style */
    verifySeriesStyle(OTHERTHREAD_SERIES, ISeries.SeriesType.LINE, GREEN, LineStyle.SOLID, true);
}
 
Example 13
Source File: ControlViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Test enable event (all kernel tracepoints) on session level
 */
protected void testEnableKernelEvent() {
    SWTBotTreeItem sessionItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName());

    sessionItem.select();
    SWTBotMenu menuBot = sessionItem.contextMenu(ControlViewSwtBotUtil.ENABLE_EVENT_DEFAULT_CHANNEL_MENU_ITEM);
    menuBot.click();

    SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.ENABLE_EVENT_DIALOG_TITLE).activate();

    shell.bot().radioInGroup(ControlViewSwtBotUtil.GROUP_SELECT_NAME, ControlViewSwtBotUtil.TRACEPOINTS_GROUP_NAME).click();

    SWTBotTree tracepointsTree = shell.bot().treeInGroup(ControlViewSwtBotUtil.TRACEPOINTS_GROUP_NAME);
    SWTBotTreeItem allItem = SWTBotUtils.getTreeItem(fBot, tracepointsTree, ControlViewSwtBotUtil.ALL_TREE_NODE);
    allItem.check();
    shell.bot().button(ControlViewSwtBotUtil.DIALOG_OK_BUTTON).click();
    WaitUtils.waitForJobs();

    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, sessionItem));

    SWTBotTreeItem channelItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME);
    assertEquals(ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME, channelItem.getText());

    SWTBotTreeItem eventItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.ALL_EVENTS_NAME);
    assertEquals(ControlViewSwtBotUtil.ALL_EVENTS_NAME, eventItem.getText());

    SWTBotTreeItem kernelDomainItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME);
    assertEquals(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, kernelDomainItem.getText());
}
 
Example 14
Source File: ControlViewKernelFilterTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void testEnableKernelEvent() {
    SWTBotTreeItem sessionItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName());

    sessionItem.select();
    SWTBotMenu menuBot = sessionItem.contextMenu(ControlViewSwtBotUtil.ENABLE_EVENT_DEFAULT_CHANNEL_MENU_ITEM);
    menuBot.click();

    SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.ENABLE_EVENT_DIALOG_TITLE).activate();

    shell.bot().radioInGroup(ControlViewSwtBotUtil.GROUP_SELECT_NAME, ControlViewSwtBotUtil.TRACEPOINTS_GROUP_NAME).click();

    SWTBotTree tracepointsTree = shell.bot().tree();
    SWTBotTreeItem allItem = SWTBotUtils.getTreeItem(fBot, tracepointsTree, ControlViewSwtBotUtil.ALL_TREE_NODE);
    allItem.check();

    SWTBotText filterText = shell.bot().textInGroup(ControlViewSwtBotUtil.FILTER_EXPRESSION_LABEL);
    filterText.setText(FILTER_EXPRESSION);
    shell.bot().button(ControlViewSwtBotUtil.DIALOG_OK_BUTTON).click();
    WaitUtils.waitForJobs();

    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, sessionItem));

    SWTBotTreeItem kernelDomainItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME);
    assertEquals(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, kernelDomainItem.getText());

    SWTBotTreeItem channelItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME);
    assertEquals(ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME, channelItem.getText());

    SWTBotTreeItem eventItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.ALL_EVENTS_NAME);
    assertEquals(ControlViewSwtBotUtil.ALL_EVENTS_NAME, eventItem.getText());

    ITraceControlComponent comp = ControlViewSwtBotUtil.getComponent(fNode,
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.ALL_EVENTS_NAME);
    assertNotNull(comp);
    assertTrue(comp instanceof TraceEventComponent);
    TraceEventComponent event = (TraceEventComponent) comp;
    assertEquals(FILTER_EXPRESSION_DISPLAY, event.getFilterExpression());
}
 
Example 15
Source File: ControlViewExcludeEventsTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Enable all UST events with one excluded event.
 */
protected void testEnableUstEventExclude() {
    // Getting the 'Sessions' tree
    SWTBotTreeItem sessionItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName());
    sessionItem.select();

    // Clicking on the 'Enable Event (default channel)...'
    SWTBotMenu menuBot = sessionItem.contextMenu(ControlViewSwtBotUtil.ENABLE_EVENT_DEFAULT_CHANNEL_MENU_ITEM);
    menuBot.click();

    SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.ENABLE_EVENT_DIALOG_TITLE).activate();

    // Switching to the UST domain
    shell.bot().radioInGroup(ControlViewSwtBotUtil.UST_GROUP_NAME, ControlViewSwtBotUtil.DOMAIN_GROUP_NAME).click();

    // Selecting all UST events
    SWTBotTree tracepointsTree = shell.bot().treeInGroup(ControlViewSwtBotUtil.TRACEPOINTS_GROUP_NAME);
    SWTBotTreeItem treeItem = tracepointsTree.getTreeItem(ControlViewSwtBotUtil.ALL_TREE_NODE);
    treeItem.check();

    // Click the checkbox for the Exclude event
    shell.bot().checkBoxInGroup(ControlViewSwtBotUtil.GROUP_SELECT_NAME, ControlViewSwtBotUtil.EXCLUDE_EVENT_LABEL).click();

    // Enter the event to exclude in the text field
    SWTBotText excludeText = shell.bot().textInGroup(ControlViewSwtBotUtil.EXCLUDE_EVENT_LABEL);
    excludeText.setText(EXCLUDE_EXPRESSION);

    // Click the Ok at the bottom of the dialog window
    shell.bot().button(ControlViewSwtBotUtil.DIALOG_OK_BUTTON).click();
    WaitUtils.waitForJobs();

    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(ControlViewSwtBotUtil.UST_DOMAIN_NAME, sessionItem));

    // Assert that the domain is UST global
    SWTBotTreeItem ustGlobalDomainItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.UST_DOMAIN_NAME);
    assertEquals(ControlViewSwtBotUtil.UST_DOMAIN_NAME, ustGlobalDomainItem.getText());

    // Assert that the new channel name is channel0 (which is the default name)
    SWTBotTreeItem channelItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.UST_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME);
    assertEquals(ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME, channelItem.getText());

    // Assert that the event type in the channel node are correct (all events = *)
    SWTBotTreeItem eventItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.UST_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.ALL_EVENTS_NAME);
    assertEquals(ControlViewSwtBotUtil.ALL_EVENTS_NAME, eventItem.getText());

    // Assert that the excluded event is the correct one
    ITraceControlComponent comp = ControlViewSwtBotUtil.getComponent(fNode,
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.UST_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.ALL_EVENTS_NAME);
    assertNotNull(comp);
    assertTrue(comp instanceof TraceEventComponent);
    TraceEventComponent event = (TraceEventComponent) comp;
    assertEquals(EXCLUDE_EXPRESSION, event.getExcludedEvents());
}
 
Example 16
Source File: SWTBotImportWizardUtils.java    From tracecompass with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * While in the import wizard, select a folder in the file selection tree.
 *
 * @param bot
 *            the SWTBot
 * @param check
 *            whether or not to check the folder item
 * @param treePath
 *            the path to the folder in the tree
 */
public static void selectFolder(SWTBot bot, boolean check, String... treePath) {
    SWTBotTree tree = bot.tree();
    bot.waitUntil(Conditions.widgetIsEnabled(tree));
    SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(bot, tree, treePath);
    folderNode.select();
    if (check) {
        folderNode.check();
    }
}