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 org
.eclipse
.swtbot
.swt
.finder
.waits
.ICondition
;
13 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.TargetNodeState
;
14 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.TraceSessionState
;
15 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
.TargetNodeComponent
;
16 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
.TraceSessionComponent
;
17 import org
.eclipse
.tracecompass
.tmf
.ui
.swtbot
.tests
.shared
.ConditionHelpers
.SWTBotTestCondition
;
20 * SWTBot utilities for ControlView test
22 * @author Bernd Hufmann
24 class ControlViewSwtBotUtil
{
26 public static final String USER_HOME
= System
.getProperty("user.home");
27 public static final String DEFAULT_CHANNEL_NAME
= "channel0";
28 public static final String KERNEL_DOMAIN_NAME
= "Kernel";
29 public static final String UST_DOMAIN_NAME
= "UST global";
30 public static final String SESSION_GROUP_NAME
= "Sessions";
31 public static final String ALL_EVENTS_NAME
= "*";
32 public static final String PROFILE_SUFFIX
= ".lttng";
35 public static final String CONNECT_MENU_ITEM
= "Connect";
36 public static final String CREATE_SESSION_MENU_ITEM
= "Create Session...";
37 public static final String ENABLE_EVENT_DEFAULT_CHANNEL_MENU_ITEM
= "Enable Event (default channel)...";
38 public static final String ENABLE_CHANNEL_MENU_ITEM
= "Enable Channel...";
39 public static final String ENABLE_EVENT_MENU_ITEM
= "Enable Event...";
40 public static final String START_MENU_ITEM
= "Start";
41 public static final String STOP_MENU_ITEM
= "Stop";
42 public static final String DESTROY_MENU_ITEM
= "Destroy Session...";
43 public static final String DISCONNECT_MENU_ITEM
= "Disconnect";
44 public static final String SAVE_MENU_ITEM
= "Save...";
45 public static final String LOAD_MENU_ITEM
= "Load...";
48 public static final String CREATE_SESSION_DIALOG_TITLE
= "Create Session";
49 public static final String SESSION_NAME_LABEL
= "Session Name";
50 public static final String DIALOG_OK_BUTTON
= "Ok";
51 public static final String CONFIRM_DIALOG_OK_BUTTON
= "OK";
52 public static final String ENABLE_EVENT_DIALOG_TITLE
= "Enable Events";
53 public static final String ALL_TREE_NODE
= "All";
54 public static final String SYSCALL_GROUP_NAME
= "All Syscalls";
55 public static final String GROUP_SELECT_NAME
= "Select";
56 public static final String ENABLE_CHANNEL_DIALOG_TITLE
= "Enable Channel";
57 public static final String DOMAIN_GROUP_NAME
= "Domain";
58 public static final String UST_GROUP_NAME
= "UST";
59 public static final String BUFFERTYPE_GROUP_NAME
= "Buffer Type";
60 public static final String BUFFERTYPE_PER_UID
= "Per UID buffers";
62 public static final String DESTROY_CONFIRM_DIALOG_TITLE
= "Destroy Confirmation";
63 public static final String CHANNEL_NAME_LABEL
= "Channel Name";
65 public static final String SAVE_DIALOG_TITLE
= "Save Sessions";
66 public static final String LOAD_DIALOG_TITLE
= "Load Sessions";
67 public static final String REMOTE_RADIO_BUTTON_LABEL
= "Remote";
69 private ControlViewSwtBotUtil() { }
72 * Tests for Target node state
75 * target node component
78 * @return the condition instance
80 public static ICondition
isStateChanged(final TargetNodeComponent node
, final TargetNodeState state
) {
81 return new SWTBotTestCondition() {
83 public boolean test() throws Exception
{
84 if (node
.getTargetNodeState() != state
) {
93 * Tests for session state
96 * the session component
99 * @return the condition instance
101 public static ICondition
isSessionStateChanged(final TraceSessionComponent session
, final TraceSessionState state
) {
102 return new SWTBotTestCondition() {
104 public boolean test() throws Exception
{
105 if (session
.getSessionState() != state
) {
114 * Finds a session for given node
117 * target node component
119 * session name to find
120 * @return the session component or null
122 public static TraceSessionComponent
getSessionComponent(TargetNodeComponent target
, String sessionName
) {
123 final TraceSessionComponent
[] sessions
= target
.getSessions();
124 if (sessions
!= null) {
125 for (int i
= 0; i
< sessions
.length
; i
++) {
126 if (sessionName
.equals(sessions
[i
].getName())) {