Change warnings to errors in build.properties
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.control.ui.tests / src / org / eclipse / tracecompass / lttng2 / control / ui / tests / model / component / TraceControlUstSessionTest.java
CommitLineData
a26d90be 1/**********************************************************************
533d0bc3 2 * Copyright (c) 2012, 2015 Ericsson
cfdb727a 3 *
a26d90be
BH
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
cfdb727a
AM
8 *
9 * Contributors:
a26d90be 10 * Bernd Hufmann - Initial API and implementation
2ba3d0a1 11 * Alexandre Montplaisir - Port to JUnit4
b732adaa 12 * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
a26d90be 13 **********************************************************************/
2ba3d0a1 14
9bc60be7 15package org.eclipse.tracecompass.lttng2.control.ui.tests.model.component;
a26d90be 16
b732adaa
MS
17import static org.junit.Assert.assertEquals;
18import static org.junit.Assert.assertNotNull;
362278af 19import static org.junit.Assert.assertNull;
b732adaa 20import static org.junit.Assert.assertTrue;
2ba3d0a1 21
a26d90be
BH
22import java.io.File;
23import java.net.URL;
24import java.util.ArrayList;
25import java.util.List;
26
a26d90be 27import org.eclipse.core.runtime.FileLocator;
362278af
BH
28import org.eclipse.core.runtime.ILogListener;
29import org.eclipse.core.runtime.IStatus;
a26d90be 30import org.eclipse.core.runtime.Path;
d8a4fd60 31import org.eclipse.jdt.annotation.NonNull;
b732adaa 32import org.eclipse.remote.core.IRemoteConnection;
1bc37054 33import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceDomainType;
9bc60be7
AM
34import org.eclipse.tracecompass.internal.lttng2.control.core.model.LogLevelType;
35import org.eclipse.tracecompass.internal.lttng2.control.core.model.TargetNodeState;
36import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceChannelOutputType;
37import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceEnablement;
38import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceEventType;
39import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceLogLevel;
40import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceSessionState;
41import org.eclipse.tracecompass.internal.lttng2.control.core.model.impl.BufferType;
42import org.eclipse.tracecompass.internal.lttng2.control.core.model.impl.ChannelInfo;
362278af 43import org.eclipse.tracecompass.internal.lttng2.control.stubs.dialogs.AddContextDialogStub;
9bc60be7
AM
44import org.eclipse.tracecompass.internal.lttng2.control.stubs.dialogs.CreateSessionDialogStub;
45import org.eclipse.tracecompass.internal.lttng2.control.stubs.dialogs.DestroyConfirmDialogStub;
46import org.eclipse.tracecompass.internal.lttng2.control.stubs.dialogs.EnableChannelDialogStub;
47import org.eclipse.tracecompass.internal.lttng2.control.stubs.dialogs.EnableEventsDialogStub;
48import org.eclipse.tracecompass.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
49import org.eclipse.tracecompass.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
362278af 50import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator;
9bc60be7
AM
51import org.eclipse.tracecompass.internal.lttng2.control.ui.views.dialogs.TraceControlDialogFactory;
52import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceControlComponent;
53import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
54import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceChannelComponent;
55import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent;
56import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceEventComponent;
57import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
b6b4e8b4 58import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
a26d90be
BH
59import org.junit.After;
60import org.junit.Before;
2ba3d0a1 61import org.junit.Test;
9269df72 62import org.osgi.framework.FrameworkUtil;
a26d90be
BH
63
64/**
2ba3d0a1
AM
65 * The class <code>TraceControlUstSessionTests</code> contains UST
66 * session/channel/event handling test cases.
a26d90be 67 */
b0d2c558 68public class TraceControlUstSessionTest {
a26d90be
BH
69
70 // ------------------------------------------------------------------------
71 // Constants
72 // ------------------------------------------------------------------------
2ba3d0a1 73
a26d90be
BH
74 private static final String TEST_STREAM = "CreateTreeTest.cfg";
75 private static final String SCEN_SCENARIO4_TEST = "Scenario4";
76
77 // ------------------------------------------------------------------------
78 // Test data
79 // ------------------------------------------------------------------------
b6b4e8b4 80 private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
a26d90be 81 private TraceControlTestFacility fFacility;
d8a4fd60 82 private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
cfdb727a
AM
83 private String fTestFile;
84
a26d90be
BH
85 // ------------------------------------------------------------------------
86 // Housekeeping
87 // ------------------------------------------------------------------------
88
89 /**
90 * Perform pre-test initialization.
91 *
92 * @throws Exception
93 * if the initialization fails for some reason
a26d90be 94 */
a26d90be
BH
95 @Before
96 public void setUp() throws Exception {
97 fFacility = TraceControlTestFacility.getInstance();
1c3c5807 98 fFacility.init();
9269df72 99 URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(TraceControlTestFacility.DIRECTORY + File.separator + TEST_STREAM), null);
a26d90be
BH
100 File testfile = new File(FileLocator.toFileURL(location).toURI());
101 fTestFile = testfile.getAbsolutePath();
102 }
103
104 /**
105 * Perform post-test clean-up.
a26d90be 106 */
a26d90be 107 @After
2ba3d0a1 108 public void tearDown() {
1c3c5807 109 fFacility.dispose();
a26d90be 110 }
cfdb727a 111
a26d90be
BH
112 /**
113 * Run the TraceControlComponent.
cfdb727a
AM
114 *
115 * @throws Exception
116 * This will fail the test
a26d90be 117 */
2ba3d0a1 118 @Test
a26d90be 119 public void testTraceSessionTree() throws Exception {
cfdb727a 120
a26d90be
BH
121 fProxy.setTestFile(fTestFile);
122 fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
cfdb727a 123
1c3c5807 124 ITraceControlComponent root = fFacility.getControlView().getTraceControlRoot();
a26d90be 125
d8a4fd60 126 TargetNodeComponent node = new TargetNodeComponent("myNode", root, fProxy);
a26d90be
BH
127
128 root.addChild(node);
a26d90be
BH
129 fFacility.waitForJobs();
130
b957fb8c
BH
131 fFacility.executeCommand(node, "connect");
132 int i = 0;
133 while ((i < 10) && (node.getTargetNodeState() != TargetNodeState.CONNECTED)) {
134 i++;
135 fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
136 }
a26d90be
BH
137
138 // Get provider groups
139 ITraceControlComponent[] groups = node.getChildren();
140 assertNotNull(groups);
141 assertEquals(2, groups.length);
142
143 // Initialize dialog implementations for command execution
144 TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub());
145 TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub());
146 TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
147
148 // Initialize session handling scenario
149 fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
cfdb727a 150
a26d90be
BH
151 // ------------------------------------------------------------------------
152 // Create session
153 // ------------------------------------------------------------------------
154 TraceSessionComponent session = fFacility.createSession(groups[1]);
cfdb727a 155
a26d90be
BH
156 // Verify that session was created
157 assertNotNull(session);
158 assertEquals("mysession", session.getName());
159 assertEquals("/home/user/lttng-traces/mysession-20120314-132824", session.getSessionPath());
160 assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
161
162 // Initialize scenario
163 fProxy.setScenario(SCEN_SCENARIO4_TEST);
cfdb727a 164
a26d90be
BH
165 // ------------------------------------------------------------------------
166 // Enable default channel on created session above
167 // ------------------------------------------------------------------------
d62bfa55 168 EnableChannelDialogStub channelStub = new EnableChannelDialogStub();
1bc37054 169 channelStub.setDomain(TraceDomainType.UST);
d62bfa55 170 TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub);
a26d90be 171
d62bfa55 172 fFacility.executeCommand(session, "enableChannelOnSession");
cfdb727a 173
a26d90be
BH
174 // Verify that Kernel domain was created
175 ITraceControlComponent[] domains = session.getChildren();
176 assertNotNull(domains);
177 assertEquals(1, domains.length);
178
179 assertEquals("UST global", domains[0].getName());
83051fc3 180 assertEquals("Domain buffer Type", BufferType.BUFFER_TYPE_UNKNOWN, ((TraceDomainComponent)domains[0]).getBufferType());
cfdb727a 181
a26d90be
BH
182 // Verify that channel was created with correct data
183 ITraceControlComponent[] channels = domains[0].getChildren();
184 assertNotNull(channels);
185 assertEquals(1, channels.length);
186
187 assertTrue(channels[0] instanceof TraceChannelComponent);
cfdb727a 188 TraceChannelComponent channel = (TraceChannelComponent) channels[0];
a26d90be
BH
189 assertEquals("mychannel", channel.getName());
190 assertEquals(4, channel.getNumberOfSubBuffers());
0ad9fc89
JRJ
191 assertEquals("mmap()", channel.getOutputType().getInName());
192 assertEquals(TraceChannelOutputType.MMAP, channel.getOutputType());
a26d90be
BH
193 assertEquals(true, channel.isOverwriteMode());
194 assertEquals(200, channel.getReadTimer());
195 assertEquals(TraceEnablement.ENABLED, channel.getState());
196 assertEquals(16384, channel.getSubBufferSize());
197 assertEquals(100, channel.getSwitchTimer());
198
362278af
BH
199 // ------------------------------------------------------------------------
200 // Add context on channel
201 // ------------------------------------------------------------------------
202 AddContextDialogStub addContextStub = new AddContextDialogStub();
203 List<String> contexts = new ArrayList<>();
204 contexts.add("procname");
205 contexts.add("vtid");
206 addContextStub.setContexts(contexts);
207 TraceControlDialogFactory.getInstance().setAddContextDialog(addContextStub);
208
209 /*
210 * Currently there is nothing to verify because the list commands don't
211 * show any context information. However, the execution of the command
212 * makes sure that the correct service command line is built and
213 * executed.
214 *
215 * There was a bug in the control where the add context command was
216 * called with -k option instead of -u. Sending the -k option would
217 * cause that the command string is not found in the scenario. When a
218 * command string is not found then it is logged in the error log.
219 *
220 * Check the error log here to verify that the command was successful.
221 */
222 final IStatus[] statusToCheck = new IStatus[1];
223 ILogListener listener = new ILogListener() {
224 @Override
225 public void logging(IStatus status, String plugin) {
226 if (plugin.contentEquals(Activator.PLUGIN_ID) && (!status.isOK())) {
227 statusToCheck[0] = status;
228 }
229 }
230 };
231 Activator.getDefault().getLog().addLogListener(listener);
232
233 fFacility.executeCommand(channels[0], "addContextOnChannel");
234
235 // check that no error status was created
236 assertNull(statusToCheck[0]);
237
238 Activator.getDefault().getLog().removeLogListener(listener);
239
240 fFacility.delay(10000);
241
242 // Get Kernel domain component instance
243 domains = session.getChildren();
244 assertNotNull(domains);
245 assertEquals(1, domains.length);
246
a26d90be
BH
247 // ------------------------------------------------------------------------
248 // Enable channel on domain
249 // ------------------------------------------------------------------------
250 ChannelInfo info = (ChannelInfo)channelStub.getChannelInfo();
251 info.setName("mychannel2");
252 info.setOverwriteMode(false);
253 info.setSubBufferSize(32768);
254 info.setNumberOfSubBuffers(2);
255 info.setSwitchTimer(100);
256 info.setReadTimer(200);
257 channelStub.setChannelInfo(info);
cfdb727a 258
d62bfa55 259 fFacility.executeCommand(domains[0], "enableChannelOnDomain");
a26d90be
BH
260
261 // Get Kernel domain component instance
262 domains = session.getChildren();
263 assertNotNull(domains);
264 assertEquals(1, domains.length);
265
266 // Verify that channel was created with correct data
267 channels = domains[0].getChildren();
268 assertNotNull(channels);
269 assertEquals(2, channels.length);
270
271 assertTrue(channels[1] instanceof TraceChannelComponent);
cfdb727a 272 channel = (TraceChannelComponent) channels[1];
a26d90be
BH
273 assertEquals("mychannel2", channel.getName());
274 assertEquals(2, channel.getNumberOfSubBuffers());
0ad9fc89
JRJ
275 assertEquals("mmap()", channel.getOutputType().getInName());
276 assertEquals(TraceChannelOutputType.MMAP, channel.getOutputType());
a26d90be
BH
277 assertEquals(false, channel.isOverwriteMode());
278 assertEquals(200, channel.getReadTimer());
279 assertEquals(TraceEnablement.ENABLED, channel.getState());
280 assertEquals(32768, channel.getSubBufferSize());
281 assertEquals(100, channel.getSwitchTimer());
282
283 // ------------------------------------------------------------------------
284 // Enable event (tracepoint) on session and default channel
285 // ------------------------------------------------------------------------
286 EnableEventsDialogStub eventsDialogStub = new EnableEventsDialogStub();
287 eventsDialogStub.setIsTracePoints(true);
e0838ca1 288 List<String> events = new ArrayList<>();
a26d90be
BH
289 events.add("ust_tests_hello:tptest_sighandler");
290 eventsDialogStub.setNames(events);
1bc37054 291 eventsDialogStub.setDomain(TraceDomainType.UST);
a26d90be 292 TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub);
cfdb727a 293
a26d90be 294 fFacility.executeCommand(session, "enableEventOnSession");
cfdb727a 295
a26d90be
BH
296 // Get Kernel domain component instance
297 domains = session.getChildren();
298 assertNotNull(domains);
299 assertEquals(1, domains.length);
300
301 // Verify that channel was created with correct data
302 channels = domains[0].getChildren();
303 assertNotNull(channels);
304 assertEquals(3, channels.length);
305
306 assertTrue(channels[2] instanceof TraceChannelComponent);
cfdb727a 307 channel = (TraceChannelComponent) channels[2];
a26d90be
BH
308 assertEquals("channel0", channel.getName());
309 // No need to check parameters of default channel because that has been done in other tests
310
311 ITraceControlComponent[] channel0Events = channel.getChildren();
312 assertEquals(1, channel0Events.length);
cfdb727a 313
a26d90be
BH
314 assertTrue(channel0Events[0] instanceof TraceEventComponent);
315
316 TraceEventComponent event = (TraceEventComponent) channel0Events[0];
317 assertEquals("ust_tests_hello:tptest_sighandler", event.getName());
318 assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); // TODO
319 assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
320 assertEquals(TraceEnablement.ENABLED, event.getState());
321
322 // ------------------------------------------------------------------------
323 // Enable event (tracepoint) on domain and default channel
324 // ------------------------------------------------------------------------
325 events.clear();
326 events.add("ust_tests_hello:tptest");
327 eventsDialogStub.setNames(events);
cfdb727a 328
a26d90be 329 fFacility.executeCommand(domains[0], "enableEventOnDomain");
cfdb727a 330
a26d90be
BH
331 // Get Kernel domain component instance
332 domains = session.getChildren();
333 assertNotNull(domains);
334 assertEquals(1, domains.length);
335
336 // Verify that channel was created with correct data
337 channels = domains[0].getChildren();
cfdb727a 338 channel = (TraceChannelComponent) channels[2];
a26d90be
BH
339 // No need to check parameters of default channel because that has been done in other tests
340
341 channel0Events = channel.getChildren();
342 assertEquals(2, channel0Events.length);
cfdb727a 343
a26d90be
BH
344 assertTrue(channel0Events[1] instanceof TraceEventComponent);
345
346 event = (TraceEventComponent) channel0Events[1];
347 assertEquals("ust_tests_hello:tptest", event.getName());
348 assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); // TODO
349 assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
350 assertEquals(TraceEnablement.ENABLED, event.getState());
351
352 // ------------------------------------------------------------------------
353 // Enable event (all tracepoints) on specific channel
354 // ------------------------------------------------------------------------
355 events.clear();
356 eventsDialogStub.setNames(events);
357 eventsDialogStub.setIsAllTracePoints(true);
358
359 fFacility.executeCommand(channels[1], "enableEventOnChannel");
360
361 // Get Kernel domain component instance
362 domains = session.getChildren();
363 assertNotNull(domains);
364 assertEquals(1, domains.length);
365
366 // Verify that channel was created with correct data
367 channels = domains[0].getChildren();
cfdb727a 368 channel = (TraceChannelComponent) channels[1];
a26d90be
BH
369 // No need to check parameters of default channel because that has been done in other tests
370
371 channel = (TraceChannelComponent) channels[1];
cfdb727a 372
a26d90be
BH
373 channel0Events = channel.getChildren();
374 assertEquals(1, channel0Events.length);
cfdb727a 375
a26d90be
BH
376 assertTrue(channel0Events[0] instanceof TraceEventComponent);
377
378 event = (TraceEventComponent) channel0Events[0];
379 assertEquals("*", event.getName());
380 assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
381 assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
382 assertEquals(TraceEnablement.ENABLED, event.getState());
383
384 // ------------------------------------------------------------------------
385 // Enable event (wildcard) on specific channel
386 // ------------------------------------------------------------------------
387 events.clear();
cfdb727a 388 eventsDialogStub.setIsTracePoints(false);
a26d90be
BH
389 eventsDialogStub.setIsAllTracePoints(false);
390 eventsDialogStub.setIsWildcard(true);
391 eventsDialogStub.setWildcard("ust*");
392
393 fFacility.executeCommand(channels[0], "enableEventOnChannel");
394
395 // Get Kernel domain component instance
396 domains = session.getChildren();
397 assertNotNull(domains);
398 assertEquals(1, domains.length);
399
400 // Verify that channel was created with correct data
401 channels = domains[0].getChildren();
cfdb727a 402 channel = (TraceChannelComponent) channels[0];
a26d90be
BH
403 // No need to check parameters of default channel because that has been done in other tests
404
405 channel0Events = channel.getChildren();
406 assertEquals(1, channel0Events.length);
cfdb727a 407
a26d90be 408 assertTrue(channel0Events[0] instanceof TraceEventComponent);
cfdb727a 409
a26d90be
BH
410 event = (TraceEventComponent) channel0Events[0];
411 assertEquals("ust*", event.getName());
412 assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
413 assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
414 assertEquals(TraceEnablement.ENABLED, event.getState());
415
416 // ------------------------------------------------------------------------
417 // Enable event (wildcard) on domain
418 // ------------------------------------------------------------------------
419 events.clear();
cfdb727a 420 eventsDialogStub.setIsTracePoints(false);
a26d90be
BH
421 eventsDialogStub.setIsAllTracePoints(false);
422 eventsDialogStub.setIsWildcard(true);
423 eventsDialogStub.setWildcard("ust*");
424
425 fFacility.executeCommand(domains[0], "enableEventOnDomain");
426
427 // Get Kernel domain component instance
428 domains = session.getChildren();
429 assertNotNull(domains);
430 assertEquals(1, domains.length);
431
432 // Verify that channel was created with correct data
433 channels = domains[0].getChildren();
cfdb727a 434 channel = (TraceChannelComponent) channels[0];
a26d90be
BH
435 // No need to check parameters of default channel because that has been done in other tests
436
437 channel0Events = channel.getChildren();
438 assertEquals(1, channel0Events.length);
cfdb727a 439
a26d90be 440 assertTrue(channel0Events[0] instanceof TraceEventComponent);
cfdb727a 441
a26d90be
BH
442 event = (TraceEventComponent) channel0Events[0];
443 assertEquals("ust*", event.getName());
444 assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
445 assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
446 assertEquals(TraceEnablement.ENABLED, event.getState());
447
448 // ------------------------------------------------------------------------
449 // Enable event (wildcard) on session
450 // ------------------------------------------------------------------------
451 events.clear();
cfdb727a 452 eventsDialogStub.setIsTracePoints(false);
a26d90be
BH
453 eventsDialogStub.setIsAllTracePoints(false);
454 eventsDialogStub.setIsWildcard(true);
455 eventsDialogStub.setWildcard("ust*");
456
457 fFacility.executeCommand(domains[0], "enableEventOnDomain");
458
459 // Get Kernel domain component instance
460 domains = session.getChildren();
461 assertNotNull(domains);
462 assertEquals(1, domains.length);
463
464 // Verify that channel was created with correct data
465 channels = domains[0].getChildren();
cfdb727a 466 channel = (TraceChannelComponent) channels[2];
a26d90be
BH
467 // No need to check parameters of default channel because that has been done in other tests
468
469 channel0Events = channel.getChildren();
470 assertEquals(4, channel0Events.length);
cfdb727a 471
a26d90be 472 assertTrue(channel0Events[0] instanceof TraceEventComponent);
cfdb727a 473
a26d90be
BH
474 event = (TraceEventComponent) channel0Events[0];
475 assertEquals("u*", event.getName());
476 assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
477 assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
478 assertEquals(TraceEnablement.ENABLED, event.getState());
479
480 // ------------------------------------------------------------------------
481 // Enable event (loglevel) on domain
482 // ------------------------------------------------------------------------
483 events.clear();
484 eventsDialogStub.setIsWildcard(false);
485 eventsDialogStub.setIsLogLevel(true);
486 eventsDialogStub.setLogLevelEventName("myevent1");
487 eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL);
488 eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_WARNING);
cfdb727a 489
a26d90be
BH
490 fFacility.executeCommand(domains[0], "enableEventOnDomain");
491
492 // Get Kernel domain component instance
493 domains = session.getChildren();
494 assertNotNull(domains);
495 assertEquals(1, domains.length);
496
497 // Verify that channel was created with correct data
498 channels = domains[0].getChildren();
cfdb727a 499 channel = (TraceChannelComponent) channels[2];
a26d90be
BH
500 // No need to check parameters of default channel because that has been done in other tests
501
502 channel0Events = channel.getChildren();
503 assertEquals(5, channel0Events.length);
cfdb727a 504
a26d90be 505 assertTrue(channel0Events[0] instanceof TraceEventComponent);
cfdb727a 506
a26d90be
BH
507 event = (TraceEventComponent) channel0Events[0];
508 assertEquals("myevent1", event.getName());
509 assertEquals(TraceLogLevel.TRACE_WARNING, event.getLogLevel());
510 assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
511 assertEquals(TraceEnablement.ENABLED, event.getState());
512
513 // ------------------------------------------------------------------------
514 // Enable event (loglevel) on session
515 // ------------------------------------------------------------------------
516 eventsDialogStub.setLogLevelEventName("myevent2");
517 eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY);
518 eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION);
cfdb727a 519
a26d90be 520 fFacility.executeCommand(session, "enableEventOnSession");
cfdb727a 521
a26d90be
BH
522 // Get Kernel domain component instance
523 domains = session.getChildren();
524 assertNotNull(domains);
525 assertEquals(1, domains.length);
526
527 // Verify that channel was created with correct data
528 channels = domains[0].getChildren();
cfdb727a 529 channel = (TraceChannelComponent) channels[2];
a26d90be
BH
530 // No need to check parameters of default channel because that has been done in other tests
531
532 channel0Events = channel.getChildren();
533 assertEquals(6, channel0Events.length);
cfdb727a 534
a26d90be 535 assertTrue(channel0Events[0] instanceof TraceEventComponent);
cfdb727a 536
a26d90be
BH
537 event = (TraceEventComponent) channel0Events[0];
538 assertEquals("myevent2", event.getName());
539 assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel());
540 assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
541 assertEquals(TraceEnablement.ENABLED, event.getState());
542
543 // ------------------------------------------------------------------------
544 // Enable event (loglevel) on channel
545 // ------------------------------------------------------------------------
546 eventsDialogStub.setLogLevelEventName("myevent0");
547 eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY);
548 eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION);
cfdb727a 549
a26d90be 550 fFacility.executeCommand(channels[0], "enableEventOnChannel");
cfdb727a 551
a26d90be
BH
552 // Get Kernel domain component instance
553 domains = session.getChildren();
554 assertNotNull(domains);
555 assertEquals(1, domains.length);
556
557 // Verify that channel was created with correct data
558 channels = domains[0].getChildren();
cfdb727a 559 channel = (TraceChannelComponent) channels[0];
a26d90be
BH
560 // No need to check parameters of default channel because that has been done in other tests
561
562 channel0Events = channel.getChildren();
563 assertEquals(2, channel0Events.length);
cfdb727a 564
a26d90be 565 assertTrue(channel0Events[0] instanceof TraceEventComponent);
cfdb727a 566
a26d90be
BH
567 event = (TraceEventComponent) channel0Events[0];
568 assertEquals("myevent0", event.getName());
569 assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel());
570 assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
571 assertEquals(TraceEnablement.ENABLED, event.getState());
cfdb727a 572
a26d90be 573 // ------------------------------------------------------------------------
cfdb727a 574 // Destroy session
a26d90be
BH
575 // ------------------------------------------------------------------------
576 // Initialize session handling scenario
577 fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
578
579 fFacility.destroySession(session);
cfdb727a 580
a26d90be 581 // Verify that no more session components exist
cc703e6c 582 assertEquals("Session components still exist.", 0, groups[1].getChildren().length);
a26d90be
BH
583
584 //-------------------------------------------------------------------------
585 // Disconnect node
586 //-------------------------------------------------------------------------
587 fFacility.executeCommand(node, "disconnect");
588 assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState());
589
590 //-------------------------------------------------------------------------
591 // Delete node
592 //-------------------------------------------------------------------------
cfdb727a 593
a26d90be 594 fFacility.executeCommand(node, "delete");
cc703e6c 595 assertEquals("Node not deleted.", 0, fFacility.getControlView().getTraceControlRoot().getChildren().length);
a26d90be
BH
596 }
597}
This page took 0.127891 seconds and 5 git commands to generate.