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