1 /*******************************************************************************
2 * Copyright (c) 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.lttng2
.control
.ui
.swtbot
.tests
;
12 import static org
.junit
.Assert
.assertEquals
;
14 import org
.eclipse
.swtbot
.swt
.finder
.junit
.SWTBotJunit4ClassRunner
;
15 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotMenu
;
16 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotShell
;
17 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotTreeItem
;
18 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.TraceSessionState
;
19 import org
.eclipse
.tracecompass
.tmf
.ui
.swtbot
.tests
.shared
.ConditionHelpers
;
20 import org
.eclipse
.tracecompass
.tmf
.ui
.swtbot
.tests
.shared
.SWTBotUtils
;
21 import org
.junit
.Test
;
22 import org
.junit
.runner
.RunWith
;
25 * Test for the Control view in Trace Compass. This will test the enabling
26 * Kernel and Syscalls at the same time.
28 * @author Bernd Hufmann
30 @RunWith(SWTBotJunit4ClassRunner
.class)
31 public class ControlViewAllEventsTest
extends ControlViewTest
{
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
36 private static final String TEST_STREAM
= "CreateSessionTestLTTng2_8.cfg";
37 private static final String CREATE_SESSION_KERNEL_SCENARIO_NAME
= "CreateSessionAllKernelEvents";
39 private static final String SESSION_NAME
= "mysession";
42 protected String
getTestStream() {
47 protected String
getSessionName() {
53 public void testTraceSessionTree() {
55 fProxy
.setTestFile(fTestFile
);
56 fProxy
.setScenario(INIT_SCENARIO_NAME
);
59 // Prepare for saving of profile
60 fProxy
.setScenario(CREATE_SESSION_KERNEL_SCENARIO_NAME
);
62 testEnableKernelEvent();
63 testStartStopTracing(TraceSessionState
.ACTIVE
);
64 testStartStopTracing(TraceSessionState
.INACTIVE
);
66 testDisconnectFromNode();
70 protected void testEnableKernelEvent() {
71 SWTBotTreeItem sessionItem
= SWTBotUtils
.getTreeItem(fBot
, fTree
,
73 ControlViewSwtBotUtil
.SESSION_GROUP_NAME
,
77 SWTBotMenu menuBot
= sessionItem
.contextMenu(ControlViewSwtBotUtil
.ENABLE_EVENT_DEFAULT_CHANNEL_MENU_ITEM
);
80 SWTBotShell shell
= fBot
.shell(ControlViewSwtBotUtil
.ENABLE_EVENT_DIALOG_TITLE
).activate();
81 // all tracepoint events and syscalls
82 shell
.bot().radioInGroup(ControlViewSwtBotUtil
.GROUP_SELECT_NAME
, ControlViewSwtBotUtil
.ALL_EVENT_GROUP_NAME
).click();
83 shell
.bot().button(ControlViewSwtBotUtil
.DIALOG_OK_BUTTON
).click();
84 SWTBotUtils
.waitForJobs();
86 fBot
.waitUntil(ConditionHelpers
.IsTreeChildNodeAvailable(ControlViewSwtBotUtil
.KERNEL_DOMAIN_NAME
, sessionItem
));
88 SWTBotTreeItem channelItem
= SWTBotUtils
.getTreeItem(fBot
, fTree
,
90 ControlViewSwtBotUtil
.SESSION_GROUP_NAME
,
92 ControlViewSwtBotUtil
.KERNEL_DOMAIN_NAME
,
93 ControlViewSwtBotUtil
.DEFAULT_CHANNEL_NAME
);
94 assertEquals(ControlViewSwtBotUtil
.DEFAULT_CHANNEL_NAME
, channelItem
.getText());
96 SWTBotTreeItem eventItem
= SWTBotUtils
.getTreeItem(fBot
, fTree
,
98 ControlViewSwtBotUtil
.SESSION_GROUP_NAME
,
100 ControlViewSwtBotUtil
.KERNEL_DOMAIN_NAME
,
101 ControlViewSwtBotUtil
.DEFAULT_CHANNEL_NAME
,
102 ControlViewSwtBotUtil
.ALL_EVENTS_NAME
);
103 assertEquals(ControlViewSwtBotUtil
.ALL_EVENTS_NAME
, eventItem
.getText());