Commit | Line | Data |
---|---|---|
9ee91a86 BH |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015 Ericsson | |
3 | * | |
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 | *******************************************************************************/ | |
9 | ||
10 | package org.eclipse.tracecompass.lttng2.control.ui.swtbot.tests; | |
11 | ||
12 | import static org.junit.Assert.assertEquals; | |
13 | ||
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; | |
23 | ||
24 | /** | |
25 | * Test for the Control view in Trace Compass. This will test the enabling | |
26 | * Kernel and Syscalls at the same time. | |
27 | * | |
28 | * @author Bernd Hufmann | |
29 | */ | |
30 | @RunWith(SWTBotJunit4ClassRunner.class) | |
31 | public class ControlViewAllEventsTest extends ControlViewTest { | |
32 | ||
33 | // ------------------------------------------------------------------------ | |
34 | // Constants | |
35 | // ------------------------------------------------------------------------ | |
36 | private static final String TEST_STREAM = "CreateSessionTestLTTng2_8.cfg"; | |
37 | private static final String CREATE_SESSION_KERNEL_SCENARIO_NAME = "CreateSessionAllKernelEvents"; | |
38 | ||
39 | private static final String SESSION_NAME = "mysession"; | |
40 | ||
41 | @Override | |
42 | protected String getTestStream() { | |
43 | return TEST_STREAM; | |
44 | } | |
45 | ||
46 | @Override | |
47 | protected String getSessionName() { | |
48 | return SESSION_NAME; | |
49 | } | |
50 | ||
51 | @Override | |
52 | @Test | |
53 | public void testTraceSessionTree() { | |
54 | ||
55 | fProxy.setTestFile(fTestFile); | |
56 | fProxy.setScenario(INIT_SCENARIO_NAME); | |
57 | ||
58 | testConnectToNode(); | |
59 | // Prepare for saving of profile | |
60 | fProxy.setScenario(CREATE_SESSION_KERNEL_SCENARIO_NAME); | |
61 | testCreateSession(); | |
62 | testEnableKernelEvent(); | |
63 | testStartStopTracing(TraceSessionState.ACTIVE); | |
64 | testStartStopTracing(TraceSessionState.INACTIVE); | |
65 | testDestroySession(); | |
66 | testDisconnectFromNode(); | |
67 | } | |
68 | ||
69 | @Override | |
70 | protected void testEnableKernelEvent() { | |
71 | SWTBotTreeItem sessionItem = SWTBotUtils.getTreeItem(fBot, fTree, | |
72 | getNodeName(), | |
73 | ControlViewSwtBotUtil.SESSION_GROUP_NAME, | |
74 | getSessionName()); | |
75 | ||
76 | sessionItem.select(); | |
77 | SWTBotMenu menuBot = sessionItem.contextMenu(ControlViewSwtBotUtil.ENABLE_EVENT_DEFAULT_CHANNEL_MENU_ITEM); | |
78 | menuBot.click(); | |
79 | ||
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(); | |
85 | ||
86 | fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, sessionItem)); | |
87 | ||
88 | SWTBotTreeItem channelItem = SWTBotUtils.getTreeItem(fBot, fTree, | |
89 | getNodeName(), | |
90 | ControlViewSwtBotUtil.SESSION_GROUP_NAME, | |
91 | getSessionName(), | |
92 | ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, | |
93 | ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME); | |
94 | assertEquals(ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME, channelItem.getText()); | |
95 | ||
96 | SWTBotTreeItem eventItem = SWTBotUtils.getTreeItem(fBot, fTree, | |
97 | getNodeName(), | |
98 | ControlViewSwtBotUtil.SESSION_GROUP_NAME, | |
99 | getSessionName(), | |
100 | ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, | |
101 | ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME, | |
102 | ControlViewSwtBotUtil.ALL_EVENTS_NAME); | |
103 | assertEquals(ControlViewSwtBotUtil.ALL_EVENTS_NAME, eventItem.getText()); | |
104 | } | |
105 | } |