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