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