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
.eclipse
.tracecompass
.tmf
.ui
.tests
.shared
.WaitUtils
;
22 import org
.junit
.Test
;
23 import org
.junit
.runner
.RunWith
;
26 * Test for the Control view in Trace Compass. This will test the enabling
27 * Kernel and Syscalls at the same time.
29 * @author Bernd Hufmann
31 @RunWith(SWTBotJunit4ClassRunner
.class)
32 public class ControlViewAllEventsTest
extends ControlViewTest
{
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
37 private static final String TEST_STREAM
= "CreateSessionTestLTTng2_8.cfg";
38 private static final String CREATE_SESSION_KERNEL_SCENARIO_NAME
= "CreateSessionAllKernelEvents";
40 private static final String SESSION_NAME
= "mysession";
43 protected String
getTestStream() {
48 protected String
getSessionName() {
54 public void testTraceSessionTree() {
56 fProxy
.setTestFile(fTestFile
);
57 fProxy
.setScenario(INIT_SCENARIO_NAME
);
60 // Prepare for saving of profile
61 fProxy
.setScenario(CREATE_SESSION_KERNEL_SCENARIO_NAME
);
63 testEnableKernelEvent();
64 testStartStopTracing(TraceSessionState
.ACTIVE
);
65 testStartStopTracing(TraceSessionState
.INACTIVE
);
67 testDisconnectFromNode();
71 protected void testEnableKernelEvent() {
72 SWTBotTreeItem sessionItem
= SWTBotUtils
.getTreeItem(fBot
, fTree
,
74 ControlViewSwtBotUtil
.SESSION_GROUP_NAME
,
78 SWTBotMenu menuBot
= sessionItem
.contextMenu(ControlViewSwtBotUtil
.ENABLE_EVENT_DEFAULT_CHANNEL_MENU_ITEM
);
81 SWTBotShell shell
= fBot
.shell(ControlViewSwtBotUtil
.ENABLE_EVENT_DIALOG_TITLE
).activate();
82 // all tracepoint events and syscalls
83 shell
.bot().radioInGroup(ControlViewSwtBotUtil
.GROUP_SELECT_NAME
, ControlViewSwtBotUtil
.ALL_EVENT_GROUP_NAME
).click();
84 shell
.bot().button(ControlViewSwtBotUtil
.DIALOG_OK_BUTTON
).click();
85 WaitUtils
.waitForJobs();
87 fBot
.waitUntil(ConditionHelpers
.IsTreeChildNodeAvailable(ControlViewSwtBotUtil
.KERNEL_DOMAIN_NAME
, sessionItem
));
89 SWTBotTreeItem channelItem
= SWTBotUtils
.getTreeItem(fBot
, fTree
,
91 ControlViewSwtBotUtil
.SESSION_GROUP_NAME
,
93 ControlViewSwtBotUtil
.KERNEL_DOMAIN_NAME
,
94 ControlViewSwtBotUtil
.DEFAULT_CHANNEL_NAME
);
95 assertEquals(ControlViewSwtBotUtil
.DEFAULT_CHANNEL_NAME
, channelItem
.getText());
97 SWTBotTreeItem eventItem
= SWTBotUtils
.getTreeItem(fBot
, fTree
,
99 ControlViewSwtBotUtil
.SESSION_GROUP_NAME
,
101 ControlViewSwtBotUtil
.KERNEL_DOMAIN_NAME
,
102 ControlViewSwtBotUtil
.DEFAULT_CHANNEL_NAME
,
103 ControlViewSwtBotUtil
.ALL_EVENTS_NAME
);
104 assertEquals(ControlViewSwtBotUtil
.ALL_EVENTS_NAME
, eventItem
.getText());