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