Commit | Line | Data |
---|---|---|
a26d90be BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 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 | * Contributors: | |
10 | * Bernd Hufmann - Initial API and implementation | |
11 | **********************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component; | |
13 | ||
14 | import java.io.File; | |
15 | import java.net.URL; | |
16 | import java.util.ArrayList; | |
17 | import java.util.List; | |
18 | ||
19 | import junit.framework.Test; | |
20 | import junit.framework.TestCase; | |
21 | import junit.framework.TestSuite; | |
22 | ||
23 | import org.eclipse.core.runtime.FileLocator; | |
24 | import org.eclipse.core.runtime.Path; | |
25 | import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateChannelDialogStub; | |
26 | import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub; | |
27 | import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub; | |
28 | import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableEventsDialogStub; | |
29 | import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.GetEventInfoDialogStub; | |
30 | import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy; | |
31 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.TraceControlDialogFactory; | |
32 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent; | |
33 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.LogLevelType; | |
34 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TargetNodeState; | |
35 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceEnablement; | |
36 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceEventType; | |
37 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceLogLevel; | |
38 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceSessionState; | |
39 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.ChannelInfo; | |
40 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent; | |
41 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceChannelComponent; | |
42 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent; | |
43 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent; | |
44 | import org.eclipse.linuxtools.lttng2.ui.tests.Activator; | |
45 | import org.eclipse.rse.core.model.Host; | |
46 | import org.eclipse.rse.core.model.IHost; | |
47 | import org.eclipse.rse.internal.core.model.SystemProfile; | |
48 | import org.junit.After; | |
49 | import org.junit.Before; | |
50 | ||
51 | /** | |
52 | * The class <code>TraceControlUstSessionTests</code> contains UST session/channel/event | |
53 | * handling test cases. | |
54 | */ | |
55 | @SuppressWarnings("nls") | |
56 | public class TraceControlUstSessionTests extends TestCase { | |
57 | ||
58 | // ------------------------------------------------------------------------ | |
59 | // Constants | |
60 | // ------------------------------------------------------------------------ | |
61 | private static final String TEST_STREAM = "CreateTreeTest.cfg"; | |
62 | private static final String SCEN_SCENARIO4_TEST = "Scenario4"; | |
63 | ||
64 | // ------------------------------------------------------------------------ | |
65 | // Test data | |
66 | // ------------------------------------------------------------------------ | |
67 | private TraceControlTestFacility fFacility; | |
68 | private TestRemoteSystemProxy fProxy; | |
69 | private String fTestFile; | |
70 | ||
71 | // ------------------------------------------------------------------------ | |
72 | // Static methods | |
73 | // ------------------------------------------------------------------------ | |
74 | ||
75 | /** | |
76 | * Returns test setup used when executing test case stand-alone. | |
77 | * @return Test setup class | |
78 | */ | |
79 | public static Test suite() { | |
80 | return new ModelImplTestSetup(new TestSuite(TraceControlUstSessionTests.class)); | |
81 | } | |
82 | ||
83 | // ------------------------------------------------------------------------ | |
84 | // Housekeeping | |
85 | // ------------------------------------------------------------------------ | |
86 | ||
87 | /** | |
88 | * Perform pre-test initialization. | |
89 | * | |
90 | * @throws Exception | |
91 | * if the initialization fails for some reason | |
92 | * | |
93 | */ | |
94 | @Override | |
95 | @Before | |
96 | public void setUp() throws Exception { | |
97 | fFacility = TraceControlTestFacility.getInstance(); | |
98 | fProxy = new TestRemoteSystemProxy(); | |
99 | URL location = FileLocator.find(Activator.getDefault().getBundle(), new Path(TraceControlTestFacility.DIRECTORY + File.separator + TEST_STREAM), null); | |
100 | File testfile = new File(FileLocator.toFileURL(location).toURI()); | |
101 | fTestFile = testfile.getAbsolutePath(); | |
102 | } | |
103 | ||
104 | /** | |
105 | * Perform post-test clean-up. | |
106 | * | |
107 | * @throws Exception | |
108 | * if the clean-up fails for some reason | |
109 | * | |
110 | */ | |
111 | @Override | |
112 | @After | |
113 | public void tearDown() throws Exception { | |
b957fb8c | 114 | fFacility.waitForJobs(); |
a26d90be BH |
115 | } |
116 | ||
117 | /** | |
118 | * Run the TraceControlComponent. | |
119 | */ | |
120 | public void testTraceSessionTree() throws Exception { | |
121 | ||
122 | fProxy.setTestFile(fTestFile); | |
123 | fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST); | |
124 | ||
125 | ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot(); | |
126 | ||
127 | @SuppressWarnings("restriction") | |
128 | IHost host = new Host(new SystemProfile("myProfile", true)); | |
129 | host.setHostName("127.0.0.1"); | |
130 | ||
131 | TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy); | |
132 | ||
133 | root.addChild(node); | |
a26d90be BH |
134 | fFacility.waitForJobs(); |
135 | ||
b957fb8c BH |
136 | fFacility.executeCommand(node, "connect"); |
137 | int i = 0; | |
138 | while ((i < 10) && (node.getTargetNodeState() != TargetNodeState.CONNECTED)) { | |
139 | i++; | |
140 | fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY); | |
141 | } | |
a26d90be BH |
142 | |
143 | // Get provider groups | |
144 | ITraceControlComponent[] groups = node.getChildren(); | |
145 | assertNotNull(groups); | |
146 | assertEquals(2, groups.length); | |
147 | ||
148 | // Initialize dialog implementations for command execution | |
149 | TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub()); | |
150 | TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub()); | |
151 | TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub()); | |
152 | ||
153 | // Initialize session handling scenario | |
154 | fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING); | |
155 | ||
156 | // ------------------------------------------------------------------------ | |
157 | // Create session | |
158 | // ------------------------------------------------------------------------ | |
159 | TraceSessionComponent session = fFacility.createSession(groups[1]); | |
160 | ||
161 | // Verify that session was created | |
162 | assertNotNull(session); | |
163 | assertEquals("mysession", session.getName()); | |
164 | assertEquals("/home/user/lttng-traces/mysession-20120314-132824", session.getSessionPath()); | |
165 | assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); | |
166 | ||
167 | // Initialize scenario | |
168 | fProxy.setScenario(SCEN_SCENARIO4_TEST); | |
169 | ||
170 | // ------------------------------------------------------------------------ | |
171 | // Enable default channel on created session above | |
172 | // ------------------------------------------------------------------------ | |
173 | CreateChannelDialogStub channelStub = new CreateChannelDialogStub(); | |
174 | channelStub.setIsKernel(false); | |
175 | TraceControlDialogFactory.getInstance().setCreateChannelDialog(channelStub); | |
176 | ||
177 | fFacility.executeCommand(session, "createChannelOnSession"); | |
178 | ||
179 | // Verify that Kernel domain was created | |
180 | ITraceControlComponent[] domains = session.getChildren(); | |
181 | assertNotNull(domains); | |
182 | assertEquals(1, domains.length); | |
183 | ||
184 | assertEquals("UST global", domains[0].getName()); | |
185 | ||
186 | // Verify that channel was created with correct data | |
187 | ITraceControlComponent[] channels = domains[0].getChildren(); | |
188 | assertNotNull(channels); | |
189 | assertEquals(1, channels.length); | |
190 | ||
191 | assertTrue(channels[0] instanceof TraceChannelComponent); | |
192 | TraceChannelComponent channel = (TraceChannelComponent) channels[0]; | |
193 | assertEquals("mychannel", channel.getName()); | |
194 | assertEquals(4, channel.getNumberOfSubBuffers()); | |
195 | assertEquals("mmap()", channel.getOutputType()); | |
196 | assertEquals(true, channel.isOverwriteMode()); | |
197 | assertEquals(200, channel.getReadTimer()); | |
198 | assertEquals(TraceEnablement.ENABLED, channel.getState()); | |
199 | assertEquals(16384, channel.getSubBufferSize()); | |
200 | assertEquals(100, channel.getSwitchTimer()); | |
201 | ||
202 | // ------------------------------------------------------------------------ | |
203 | // Enable channel on domain | |
204 | // ------------------------------------------------------------------------ | |
205 | ChannelInfo info = (ChannelInfo)channelStub.getChannelInfo(); | |
206 | info.setName("mychannel2"); | |
207 | info.setOverwriteMode(false); | |
208 | info.setSubBufferSize(32768); | |
209 | info.setNumberOfSubBuffers(2); | |
210 | info.setSwitchTimer(100); | |
211 | info.setReadTimer(200); | |
212 | channelStub.setChannelInfo(info); | |
213 | ||
214 | fFacility.executeCommand(domains[0], "createChannelOnDomain"); | |
215 | ||
216 | // Get Kernel domain component instance | |
217 | domains = session.getChildren(); | |
218 | assertNotNull(domains); | |
219 | assertEquals(1, domains.length); | |
220 | ||
221 | // Verify that channel was created with correct data | |
222 | channels = domains[0].getChildren(); | |
223 | assertNotNull(channels); | |
224 | assertEquals(2, channels.length); | |
225 | ||
226 | assertTrue(channels[1] instanceof TraceChannelComponent); | |
227 | channel = (TraceChannelComponent) channels[1]; | |
228 | assertEquals("mychannel2", channel.getName()); | |
229 | assertEquals(2, channel.getNumberOfSubBuffers()); | |
230 | assertEquals("mmap()", channel.getOutputType()); | |
231 | assertEquals(false, channel.isOverwriteMode()); | |
232 | assertEquals(200, channel.getReadTimer()); | |
233 | assertEquals(TraceEnablement.ENABLED, channel.getState()); | |
234 | assertEquals(32768, channel.getSubBufferSize()); | |
235 | assertEquals(100, channel.getSwitchTimer()); | |
236 | ||
237 | // ------------------------------------------------------------------------ | |
238 | // Enable event (tracepoint) on session and default channel | |
239 | // ------------------------------------------------------------------------ | |
240 | EnableEventsDialogStub eventsDialogStub = new EnableEventsDialogStub(); | |
241 | eventsDialogStub.setIsTracePoints(true); | |
242 | List<String> events = new ArrayList<String>(); | |
243 | events.add("ust_tests_hello:tptest_sighandler"); | |
244 | eventsDialogStub.setNames(events); | |
245 | eventsDialogStub.setIsKernel(false); | |
246 | TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub); | |
247 | ||
248 | fFacility.executeCommand(session, "enableEventOnSession"); | |
249 | ||
250 | // Get Kernel domain component instance | |
251 | domains = session.getChildren(); | |
252 | assertNotNull(domains); | |
253 | assertEquals(1, domains.length); | |
254 | ||
255 | // Verify that channel was created with correct data | |
256 | channels = domains[0].getChildren(); | |
257 | assertNotNull(channels); | |
258 | assertEquals(3, channels.length); | |
259 | ||
260 | assertTrue(channels[2] instanceof TraceChannelComponent); | |
261 | channel = (TraceChannelComponent) channels[2]; | |
262 | assertEquals("channel0", channel.getName()); | |
263 | // No need to check parameters of default channel because that has been done in other tests | |
264 | ||
265 | ITraceControlComponent[] channel0Events = channel.getChildren(); | |
266 | assertEquals(1, channel0Events.length); | |
267 | ||
268 | assertTrue(channel0Events[0] instanceof TraceEventComponent); | |
269 | ||
270 | TraceEventComponent event = (TraceEventComponent) channel0Events[0]; | |
271 | assertEquals("ust_tests_hello:tptest_sighandler", event.getName()); | |
272 | assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); // TODO | |
273 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); | |
274 | assertEquals(TraceEnablement.ENABLED, event.getState()); | |
275 | ||
276 | // ------------------------------------------------------------------------ | |
277 | // Enable event (tracepoint) on domain and default channel | |
278 | // ------------------------------------------------------------------------ | |
279 | events.clear(); | |
280 | events.add("ust_tests_hello:tptest"); | |
281 | eventsDialogStub.setNames(events); | |
282 | ||
283 | fFacility.executeCommand(domains[0], "enableEventOnDomain"); | |
284 | ||
285 | // Get Kernel domain component instance | |
286 | domains = session.getChildren(); | |
287 | assertNotNull(domains); | |
288 | assertEquals(1, domains.length); | |
289 | ||
290 | // Verify that channel was created with correct data | |
291 | channels = domains[0].getChildren(); | |
292 | channel = (TraceChannelComponent) channels[2]; | |
293 | // No need to check parameters of default channel because that has been done in other tests | |
294 | ||
295 | channel0Events = channel.getChildren(); | |
296 | assertEquals(2, channel0Events.length); | |
297 | ||
298 | assertTrue(channel0Events[1] instanceof TraceEventComponent); | |
299 | ||
300 | event = (TraceEventComponent) channel0Events[1]; | |
301 | assertEquals("ust_tests_hello:tptest", event.getName()); | |
302 | assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); // TODO | |
303 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); | |
304 | assertEquals(TraceEnablement.ENABLED, event.getState()); | |
305 | ||
306 | // ------------------------------------------------------------------------ | |
307 | // Enable event (all tracepoints) on specific channel | |
308 | // ------------------------------------------------------------------------ | |
309 | events.clear(); | |
310 | eventsDialogStub.setNames(events); | |
311 | eventsDialogStub.setIsAllTracePoints(true); | |
312 | ||
313 | fFacility.executeCommand(channels[1], "enableEventOnChannel"); | |
314 | ||
315 | // Get Kernel domain component instance | |
316 | domains = session.getChildren(); | |
317 | assertNotNull(domains); | |
318 | assertEquals(1, domains.length); | |
319 | ||
320 | // Verify that channel was created with correct data | |
321 | channels = domains[0].getChildren(); | |
322 | channel = (TraceChannelComponent) channels[1]; | |
323 | // No need to check parameters of default channel because that has been done in other tests | |
324 | ||
325 | channel = (TraceChannelComponent) channels[1]; | |
326 | ||
327 | channel0Events = channel.getChildren(); | |
328 | assertEquals(1, channel0Events.length); | |
329 | ||
330 | assertTrue(channel0Events[0] instanceof TraceEventComponent); | |
331 | ||
332 | event = (TraceEventComponent) channel0Events[0]; | |
333 | assertEquals("*", event.getName()); | |
334 | assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); | |
335 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); | |
336 | assertEquals(TraceEnablement.ENABLED, event.getState()); | |
337 | ||
338 | // ------------------------------------------------------------------------ | |
339 | // Enable event (wildcard) on specific channel | |
340 | // ------------------------------------------------------------------------ | |
341 | events.clear(); | |
342 | eventsDialogStub.setIsTracePoints(false); | |
343 | eventsDialogStub.setIsAllTracePoints(false); | |
344 | eventsDialogStub.setIsWildcard(true); | |
345 | eventsDialogStub.setWildcard("ust*"); | |
346 | ||
347 | fFacility.executeCommand(channels[0], "enableEventOnChannel"); | |
348 | ||
349 | // Get Kernel domain component instance | |
350 | domains = session.getChildren(); | |
351 | assertNotNull(domains); | |
352 | assertEquals(1, domains.length); | |
353 | ||
354 | // Verify that channel was created with correct data | |
355 | channels = domains[0].getChildren(); | |
356 | channel = (TraceChannelComponent) channels[0]; | |
357 | // No need to check parameters of default channel because that has been done in other tests | |
358 | ||
359 | channel0Events = channel.getChildren(); | |
360 | assertEquals(1, channel0Events.length); | |
361 | ||
362 | assertTrue(channel0Events[0] instanceof TraceEventComponent); | |
363 | ||
364 | event = (TraceEventComponent) channel0Events[0]; | |
365 | assertEquals("ust*", event.getName()); | |
366 | assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); | |
367 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); | |
368 | assertEquals(TraceEnablement.ENABLED, event.getState()); | |
369 | ||
370 | // ------------------------------------------------------------------------ | |
371 | // Enable event (wildcard) on domain | |
372 | // ------------------------------------------------------------------------ | |
373 | events.clear(); | |
374 | eventsDialogStub.setIsTracePoints(false); | |
375 | eventsDialogStub.setIsAllTracePoints(false); | |
376 | eventsDialogStub.setIsWildcard(true); | |
377 | eventsDialogStub.setWildcard("ust*"); | |
378 | ||
379 | fFacility.executeCommand(domains[0], "enableEventOnDomain"); | |
380 | ||
381 | // Get Kernel domain component instance | |
382 | domains = session.getChildren(); | |
383 | assertNotNull(domains); | |
384 | assertEquals(1, domains.length); | |
385 | ||
386 | // Verify that channel was created with correct data | |
387 | channels = domains[0].getChildren(); | |
388 | channel = (TraceChannelComponent) channels[0]; | |
389 | // No need to check parameters of default channel because that has been done in other tests | |
390 | ||
391 | channel0Events = channel.getChildren(); | |
392 | assertEquals(1, channel0Events.length); | |
393 | ||
394 | assertTrue(channel0Events[0] instanceof TraceEventComponent); | |
395 | ||
396 | event = (TraceEventComponent) channel0Events[0]; | |
397 | assertEquals("ust*", event.getName()); | |
398 | assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); | |
399 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); | |
400 | assertEquals(TraceEnablement.ENABLED, event.getState()); | |
401 | ||
402 | // ------------------------------------------------------------------------ | |
403 | // Enable event (wildcard) on session | |
404 | // ------------------------------------------------------------------------ | |
405 | events.clear(); | |
406 | eventsDialogStub.setIsTracePoints(false); | |
407 | eventsDialogStub.setIsAllTracePoints(false); | |
408 | eventsDialogStub.setIsWildcard(true); | |
409 | eventsDialogStub.setWildcard("ust*"); | |
410 | ||
411 | fFacility.executeCommand(domains[0], "enableEventOnDomain"); | |
412 | ||
413 | // Get Kernel domain component instance | |
414 | domains = session.getChildren(); | |
415 | assertNotNull(domains); | |
416 | assertEquals(1, domains.length); | |
417 | ||
418 | // Verify that channel was created with correct data | |
419 | channels = domains[0].getChildren(); | |
420 | channel = (TraceChannelComponent) channels[2]; | |
421 | // No need to check parameters of default channel because that has been done in other tests | |
422 | ||
423 | channel0Events = channel.getChildren(); | |
424 | assertEquals(4, channel0Events.length); | |
425 | ||
426 | assertTrue(channel0Events[0] instanceof TraceEventComponent); | |
427 | ||
428 | event = (TraceEventComponent) channel0Events[0]; | |
429 | assertEquals("u*", event.getName()); | |
430 | assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); | |
431 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); | |
432 | assertEquals(TraceEnablement.ENABLED, event.getState()); | |
433 | ||
434 | // ------------------------------------------------------------------------ | |
435 | // Enable event (loglevel) on domain | |
436 | // ------------------------------------------------------------------------ | |
437 | events.clear(); | |
438 | eventsDialogStub.setIsWildcard(false); | |
439 | eventsDialogStub.setIsLogLevel(true); | |
440 | eventsDialogStub.setLogLevelEventName("myevent1"); | |
441 | eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL); | |
442 | eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_WARNING); | |
443 | ||
444 | fFacility.executeCommand(domains[0], "enableEventOnDomain"); | |
445 | ||
446 | // Get Kernel domain component instance | |
447 | domains = session.getChildren(); | |
448 | assertNotNull(domains); | |
449 | assertEquals(1, domains.length); | |
450 | ||
451 | // Verify that channel was created with correct data | |
452 | channels = domains[0].getChildren(); | |
453 | channel = (TraceChannelComponent) channels[2]; | |
454 | // No need to check parameters of default channel because that has been done in other tests | |
455 | ||
456 | channel0Events = channel.getChildren(); | |
457 | assertEquals(5, channel0Events.length); | |
458 | ||
459 | assertTrue(channel0Events[0] instanceof TraceEventComponent); | |
460 | ||
461 | event = (TraceEventComponent) channel0Events[0]; | |
462 | assertEquals("myevent1", event.getName()); | |
463 | assertEquals(TraceLogLevel.TRACE_WARNING, event.getLogLevel()); | |
464 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); | |
465 | assertEquals(TraceEnablement.ENABLED, event.getState()); | |
466 | ||
467 | // ------------------------------------------------------------------------ | |
468 | // Enable event (loglevel) on session | |
469 | // ------------------------------------------------------------------------ | |
470 | eventsDialogStub.setLogLevelEventName("myevent2"); | |
471 | eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY); | |
472 | eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION); | |
473 | ||
474 | fFacility.executeCommand(session, "enableEventOnSession"); | |
475 | ||
476 | // Get Kernel domain component instance | |
477 | domains = session.getChildren(); | |
478 | assertNotNull(domains); | |
479 | assertEquals(1, domains.length); | |
480 | ||
481 | // Verify that channel was created with correct data | |
482 | channels = domains[0].getChildren(); | |
483 | channel = (TraceChannelComponent) channels[2]; | |
484 | // No need to check parameters of default channel because that has been done in other tests | |
485 | ||
486 | channel0Events = channel.getChildren(); | |
487 | assertEquals(6, channel0Events.length); | |
488 | ||
489 | assertTrue(channel0Events[0] instanceof TraceEventComponent); | |
490 | ||
491 | event = (TraceEventComponent) channel0Events[0]; | |
492 | assertEquals("myevent2", event.getName()); | |
493 | assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel()); | |
494 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); | |
495 | assertEquals(TraceEnablement.ENABLED, event.getState()); | |
496 | ||
497 | // ------------------------------------------------------------------------ | |
498 | // Enable event (loglevel) on channel | |
499 | // ------------------------------------------------------------------------ | |
500 | eventsDialogStub.setLogLevelEventName("myevent0"); | |
501 | eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY); | |
502 | eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION); | |
503 | ||
504 | fFacility.executeCommand(channels[0], "enableEventOnChannel"); | |
505 | ||
506 | // Get Kernel domain component instance | |
507 | domains = session.getChildren(); | |
508 | assertNotNull(domains); | |
509 | assertEquals(1, domains.length); | |
510 | ||
511 | // Verify that channel was created with correct data | |
512 | channels = domains[0].getChildren(); | |
513 | channel = (TraceChannelComponent) channels[0]; | |
514 | // No need to check parameters of default channel because that has been done in other tests | |
515 | ||
516 | channel0Events = channel.getChildren(); | |
517 | assertEquals(2, channel0Events.length); | |
518 | ||
519 | assertTrue(channel0Events[0] instanceof TraceEventComponent); | |
520 | ||
521 | event = (TraceEventComponent) channel0Events[0]; | |
522 | assertEquals("myevent0", event.getName()); | |
523 | assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel()); | |
524 | assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); | |
525 | assertEquals(TraceEnablement.ENABLED, event.getState()); | |
526 | ||
527 | // ------------------------------------------------------------------------ | |
528 | // Destroy session | |
529 | // ------------------------------------------------------------------------ | |
530 | // Initialize session handling scenario | |
531 | fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING); | |
532 | ||
533 | fFacility.destroySession(session); | |
534 | ||
535 | // Verify that no more session components exist | |
536 | assertEquals(0, groups[1].getChildren().length); | |
537 | ||
538 | //------------------------------------------------------------------------- | |
539 | // Disconnect node | |
540 | //------------------------------------------------------------------------- | |
541 | fFacility.executeCommand(node, "disconnect"); | |
542 | assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState()); | |
543 | ||
544 | //------------------------------------------------------------------------- | |
545 | // Delete node | |
546 | //------------------------------------------------------------------------- | |
547 | ||
548 | fFacility.executeCommand(node, "delete"); | |
549 | ||
550 | assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length); | |
551 | } | |
552 | } |