1 /**********************************************************************
2 * Copyright (c) 2012 Ericsson
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
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.ui
.tests
.control
.model
.component
;
14 import junit
.framework
.Test
;
15 import junit
.framework
.TestCase
;
16 import junit
.framework
.TestSuite
;
18 import org
.eclipse
.linuxtools
.lttng
.stubs
.service
.TestRemoteSystemProxy
;
19 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.IChannelInfo
;
20 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.ITraceControlComponent
;
21 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TargetNodeState
;
22 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceEnablement
;
23 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceEventType
;
24 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceLogLevel
;
25 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceSessionState
;
26 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.BaseEventComponent
;
27 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.KernelProviderComponent
;
28 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.TargetNodeComponent
;
29 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.TraceChannelComponent
;
30 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.TraceControlComponent
;
31 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.TraceEventComponent
;
32 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.TraceProviderGroup
;
33 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.TraceSessionComponent
;
34 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.TraceSessionGroup
;
35 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.UstProviderComponent
;
36 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.property
.TargetNodePropertySource
;
37 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.service
.ILttngControlService
;
38 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.service
.LTTngControlService
;
39 import org
.eclipse
.rse
.core
.model
.Host
;
40 import org
.eclipse
.rse
.core
.model
.IHost
;
41 import org
.eclipse
.rse
.internal
.core
.model
.SystemProfile
;
42 import org
.eclipse
.swt
.graphics
.Image
;
43 import org
.eclipse
.ui
.views
.properties
.IPropertySource
;
44 import org
.junit
.After
;
45 import org
.junit
.Before
;
48 * The class <code>TraceControlComponentTest</code> contains tests for the class <code>{@link TraceControlComponent}</code>.
51 @SuppressWarnings("nls")
52 public class TraceControlTreeModelTest
extends TestCase
{
54 // ------------------------------------------------------------------------
56 // ------------------------------------------------------------------------
58 // ------------------------------------------------------------------------
60 // ------------------------------------------------------------------------
63 * Returns test setup used when executing test case stand-alone.
64 * @return Test setup class
66 public static Test
suite() {
67 return new ModelImplTestSetup(new TestSuite(TraceControlTreeModelTest
.class));
70 // ------------------------------------------------------------------------
72 // ------------------------------------------------------------------------
75 * Perform pre-test initialization.
78 * if the initialization fails for some reason
83 public void setUp() throws Exception
{
87 * Perform post-test clean-up.
90 * if the clean-up fails for some reason
95 public void tearDown() throws Exception
{
99 * Run the TraceControlComponent.
101 public void testTraceControlComponents()
104 TestRemoteSystemProxy proxy
= new TestRemoteSystemProxy();
106 ITraceControlComponent root
= TraceControlTestFacility
.getInstance().getControlView().getTraceControlRoot();
108 @SuppressWarnings("restriction")
109 IHost host
= new Host(new SystemProfile("myProfile", true));
110 host
.setHostName("127.0.0.1");
112 TargetNodeComponent node
= new TargetNodeComponent("myNode", root
, host
, proxy
);
117 TraceControlTestFacility
.getInstance().waitForJobs();
119 // ------------------------------------------------------------------------
120 // Verify Node Properties (adapter)
121 // ------------------------------------------------------------------------
122 Object adapter
= node
.getAdapter(IPropertySource
.class);
123 assertNotNull(adapter
);
124 assertTrue(adapter
instanceof TargetNodePropertySource
);
126 TargetNodePropertySource source
= (TargetNodePropertySource
)adapter
;
128 assertNull(source
.getEditableValue());
129 assertFalse(source
.isPropertySet(TargetNodePropertySource
.TARGET_NODE_NAME_PROPERTY_ID
));
130 assertNotNull(source
.getPropertyDescriptors());
132 assertEquals("myNode", source
.getPropertyValue(TargetNodePropertySource
.TARGET_NODE_NAME_PROPERTY_ID
));
133 assertEquals("127.0.0.1", source
.getPropertyValue(TargetNodePropertySource
.TARGET_NODE_ADDRESS_PROPERTY_ID
));
134 assertNull(source
.getPropertyValue("test"));
136 adapter
= node
.getAdapter(IChannelInfo
.class);
139 // ------------------------------------------------------------------------
140 // Verify Parameters of TargetNodeComponent
141 // ------------------------------------------------------------------------
142 assertEquals("127.0.0.1", node
.getHostName());
143 assertEquals("127.0.0.1", node
.getToolTip());
144 Image connectedImage
= node
.getImage();
145 assertNotNull(connectedImage
);
146 assertEquals(TargetNodeState
.CONNECTED
, node
.getTargetNodeState());
147 assertNotNull(node
.getControlService());
148 ILttngControlService service
= node
.getControlService();
149 assertTrue(service
instanceof LTTngControlService
);
150 node
.setControlService(service
);
151 assertTrue(node
.getControlService() instanceof LTTngControlService
);
153 assertTrue(node
.isPassiveCommunicationsListener());
155 // ------------------------------------------------------------------------
156 // Verify Children of TargetNodeComponent
157 // ------------------------------------------------------------------------
158 ITraceControlComponent
[] groups
= node
.getChildren();
159 assertNotNull(groups
);
160 assertEquals(2, groups
.length
);
162 assertTrue(groups
[0] instanceof TraceProviderGroup
);
163 assertTrue(groups
[1] instanceof TraceSessionGroup
);
165 assertEquals("Provider", groups
[0].getName());
166 assertEquals("Sessions", groups
[1].getName());
168 // ------------------------------------------------------------------------
169 // Verify TraceProviderGroup
170 // ------------------------------------------------------------------------
171 ITraceControlComponent
[] providers
= groups
[0].getChildren();
173 assertNotNull(providers
);
174 assertEquals(3, providers
.length
);
176 // ------------------------------------------------------------------------
177 // Verify UstProviderComponent
178 // ------------------------------------------------------------------------
179 KernelProviderComponent kernelProvider
= (KernelProviderComponent
) providers
[0];
181 // ------------------------------------------------------------------------
182 // Verify event info (kernel provider)
183 // ------------------------------------------------------------------------
184 ITraceControlComponent
[] events
= kernelProvider
.getChildren();
185 assertNotNull(events
);
186 assertEquals(3, events
.length
);
188 BaseEventComponent baseEventInfo
= (BaseEventComponent
) events
[0];
189 assertNotNull(baseEventInfo
);
190 assertEquals("sched_kthread_stop", baseEventInfo
.getName());
191 assertEquals(TraceLogLevel
.TRACE_EMERG
, baseEventInfo
.getLogLevel());
192 assertEquals(TraceEventType
.TRACEPOINT
, baseEventInfo
.getEventType());
194 baseEventInfo
= (BaseEventComponent
) events
[1];
195 assertEquals("sched_kthread_stop_ret", baseEventInfo
.getName());
196 assertEquals(TraceLogLevel
.TRACE_EMERG
, baseEventInfo
.getLogLevel());
197 assertEquals(TraceEventType
.TRACEPOINT
, baseEventInfo
.getEventType());
199 baseEventInfo
= (BaseEventComponent
) events
[2];
200 assertEquals("sched_wakeup_new", baseEventInfo
.getName());
201 assertEquals(TraceLogLevel
.TRACE_EMERG
, baseEventInfo
.getLogLevel());
202 assertEquals(TraceEventType
.TRACEPOINT
, baseEventInfo
.getEventType());
204 // ------------------------------------------------------------------------
205 // Verify UstProviderComponent
206 // ------------------------------------------------------------------------
207 UstProviderComponent ustProvider
= (UstProviderComponent
) providers
[1];
208 assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustProvider
.getName());
209 assertEquals(9379, ustProvider
.getPid());
211 // ------------------------------------------------------------------------
212 // Verify event info (UST provider)
213 // ------------------------------------------------------------------------
214 events
= ustProvider
.getChildren();
215 assertNotNull(events
);
216 assertEquals(2, events
.length
);
218 baseEventInfo
= (BaseEventComponent
) events
[0];
219 assertNotNull(baseEventInfo
);
220 assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo
.getName());
221 assertEquals(TraceLogLevel
.TRACE_MODULE
, baseEventInfo
.getLogLevel());
222 assertEquals(TraceEventType
.TRACEPOINT
, baseEventInfo
.getEventType());
224 baseEventInfo
= (BaseEventComponent
) events
[1];
225 assertEquals("ust_tests_hello:tptest", baseEventInfo
.getName());
226 assertEquals(TraceLogLevel
.TRACE_INFO
, baseEventInfo
.getLogLevel());
227 assertEquals(TraceEventType
.TRACEPOINT
, baseEventInfo
.getEventType());
229 // ------------------------------------------------------------------------
230 // Verify UstProviderComponent
231 // ------------------------------------------------------------------------
232 ustProvider
= (UstProviderComponent
) providers
[2];
233 assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustProvider
.getName());
234 assertEquals(4852, ustProvider
.getPid());
236 // verify getters and setter
237 verifyUstProviderGettersSetters(ustProvider
);
239 // ------------------------------------------------------------------------
240 // Verify event info (UST provider)
241 // ------------------------------------------------------------------------
242 events
= ustProvider
.getChildren();
243 assertNotNull(events
);
244 assertEquals(2, events
.length
);
246 baseEventInfo
= (BaseEventComponent
) events
[0];
247 assertNotNull(baseEventInfo
);
248 assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo
.getName());
249 assertEquals(TraceLogLevel
.TRACE_WARNING
, baseEventInfo
.getLogLevel());
250 assertEquals(TraceEventType
.TRACEPOINT
, baseEventInfo
.getEventType());
252 baseEventInfo
= (BaseEventComponent
) events
[1];
253 assertEquals("ust_tests_hello:tptest", baseEventInfo
.getName());
254 assertEquals(TraceLogLevel
.TRACE_FUNCTION
, baseEventInfo
.getLogLevel());
255 assertEquals(TraceEventType
.TRACEPOINT
, baseEventInfo
.getEventType());
257 // verify getters and setters
258 verifyBaseEventGettersSetters(baseEventInfo
);
260 // ------------------------------------------------------------------------
261 // Verify TraceSessionGroup
262 // ------------------------------------------------------------------------
263 ITraceControlComponent
[] sessions
= groups
[1].getChildren();
264 assertNotNull(sessions
);
265 assertEquals(2, sessions
.length
);
266 for (int i
= 0; i
< sessions
.length
; i
++) {
267 assertTrue(sessions
[i
] instanceof TraceSessionComponent
);
269 assertEquals("mysession1", sessions
[0].getName());
270 assertEquals("mysession", sessions
[1].getName());
272 // ------------------------------------------------------------------------
273 // Verify TraceSessionComponent
274 // ------------------------------------------------------------------------
275 TraceSessionComponent session
= (TraceSessionComponent
)sessions
[1];
276 assertEquals("mysession", session
.getName());
277 assertEquals("/home/user/lttng-traces/mysession-20120129-084256", session
.getSessionPath());
278 assertEquals(TraceSessionState
.ACTIVE
, session
.getSessionState());
280 // Verify setters and setters
281 verifySessionGetterSetters(session
);
283 ITraceControlComponent
[] domains
= session
.getChildren();
284 assertNotNull(domains
);
285 assertEquals(2, domains
.length
);
287 // ------------------------------------------------------------------------
288 // Verify Kernel domain
289 // ------------------------------------------------------------------------
290 assertEquals("Kernel", domains
[0].getName());
291 ITraceControlComponent
[] channels
= domains
[0].getChildren();
292 assertNotNull(channels
);
293 assertEquals(2, channels
.length
);
295 // ------------------------------------------------------------------------
296 // Verify Kernel's channel0
297 // ------------------------------------------------------------------------
298 assertTrue(channels
[0] instanceof TraceChannelComponent
);
299 TraceChannelComponent channel
= (TraceChannelComponent
) channels
[0];
300 assertEquals("channel0", channel
.getName());
301 assertEquals(4, channel
.getNumberOfSubBuffers());
302 assertEquals("splice()", channel
.getOutputType());
303 assertEquals(false, channel
.isOverwriteMode());
304 assertEquals(200, channel
.getReadTimer());
305 assertEquals(TraceEnablement
.ENABLED
, channel
.getState());
306 assertEquals(262144, channel
.getSubBufferSize());
307 assertEquals(0, channel
.getSwitchTimer());
309 // ------------------------------------------------------------------------
310 // Verify event info (kernel, channel0)
311 // ------------------------------------------------------------------------
312 ITraceControlComponent
[] channel0Events
= channel
.getChildren();
313 assertNotNull(channel0Events
);
314 assertEquals(2, channel0Events
.length
);
315 assertTrue(channel0Events
[0] instanceof TraceEventComponent
);
316 assertTrue(channel0Events
[1] instanceof TraceEventComponent
);
318 TraceEventComponent event
= (TraceEventComponent
) channel0Events
[0];
319 assertEquals("block_rq_remap", event
.getName());
320 assertEquals(TraceLogLevel
.TRACE_EMERG
, event
.getLogLevel());
321 assertEquals(TraceEventType
.TRACEPOINT
, event
.getEventType());
322 assertEquals(TraceEnablement
.ENABLED
, event
.getState());
324 event
= (TraceEventComponent
) channel0Events
[1];
325 assertEquals("block_bio_remap", event
.getName());
326 assertEquals(TraceLogLevel
.TRACE_EMERG
, event
.getLogLevel());
327 assertEquals(TraceEventType
.TRACEPOINT
, event
.getEventType());
328 assertEquals(TraceEnablement
.DISABLED
, event
.getState());
330 // ------------------------------------------------------------------------
331 // Verify Kernel's channel1
332 // ------------------------------------------------------------------------
333 assertEquals("channel1", channels
[1].getName());
334 channel
= (TraceChannelComponent
) channels
[1];
335 assertEquals(4, channel
.getNumberOfSubBuffers());
336 assertEquals("splice()", channel
.getOutputType());
337 assertEquals(true, channel
.isOverwriteMode());
338 assertEquals(400, channel
.getReadTimer());
339 assertEquals(TraceEnablement
.DISABLED
, channel
.getState());
340 assertEquals(524288, channel
.getSubBufferSize());
341 assertEquals(100, channel
.getSwitchTimer());
343 // ------------------------------------------------------------------------
344 // Verify event info (kernel, channel1)
345 // ------------------------------------------------------------------------
346 ITraceControlComponent
[] channel1Events
= channels
[1].getChildren();
347 assertEquals(0, channel1Events
.length
);
349 // ------------------------------------------------------------------------
350 // Verify domain UST global
351 // ------------------------------------------------------------------------
352 assertEquals("UST global", domains
[1].getName());
354 ITraceControlComponent
[] ustChannels
= domains
[1].getChildren();
356 for (int i
= 0; i
< ustChannels
.length
; i
++) {
357 assertTrue(ustChannels
[i
] instanceof TraceChannelComponent
);
360 // ------------------------------------------------------------------------
361 // Verify UST global's mychannel1
362 // ------------------------------------------------------------------------
363 channel
= (TraceChannelComponent
) ustChannels
[0];
364 assertEquals("mychannel1", channel
.getName());
365 assertEquals(8, channel
.getNumberOfSubBuffers());
366 assertEquals("mmap()", channel
.getOutputType());
367 assertEquals(true, channel
.isOverwriteMode());
368 assertEquals(100, channel
.getReadTimer());
369 assertEquals(TraceEnablement
.DISABLED
, channel
.getState());
370 assertEquals(8192, channel
.getSubBufferSize());
371 assertEquals(200, channel
.getSwitchTimer());
373 // verify getters and setters
374 verifyChannelGettersSetters(channel
);
376 // ------------------------------------------------------------------------
377 // Verify event info (UST global, mychannel1)
378 // ------------------------------------------------------------------------
379 ITraceControlComponent
[] ustEvents
= channel
.getChildren();
380 assertEquals(0, ustEvents
.length
);
382 // ------------------------------------------------------------------------
383 // Verify UST global's channel0
384 // ------------------------------------------------------------------------
385 channel
= (TraceChannelComponent
) ustChannels
[1];
386 assertEquals("channel0", channel
.getName());
387 assertEquals(4, channel
.getNumberOfSubBuffers());
388 assertEquals("mmap()", channel
.getOutputType());
389 assertEquals(false, channel
.isOverwriteMode());
390 assertEquals(200, channel
.getReadTimer());
391 assertEquals(TraceEnablement
.ENABLED
, channel
.getState());
392 assertEquals(4096, channel
.getSubBufferSize());
393 assertEquals(0, channel
.getSwitchTimer());
395 // ------------------------------------------------------------------------
396 // Verify event info (UST global, channel0)
397 // ------------------------------------------------------------------------
398 ustEvents
= channel
.getChildren();
399 assertEquals(2, ustEvents
.length
);
401 event
= (TraceEventComponent
) ustEvents
[0];
402 assertEquals("ust_tests_hello:tptest_sighandler", event
.getName());
403 assertEquals(TraceLogLevel
.TRACE_DEFAULT
, event
.getLogLevel());
404 assertEquals(TraceEventType
.TRACEPOINT
, event
.getEventType());
405 assertEquals(TraceEnablement
.DISABLED
, event
.getState());
407 event
= (TraceEventComponent
) ustEvents
[1];
408 assertEquals("*", ustEvents
[1].getName());
409 assertEquals(TraceLogLevel
.TRACE_EMERG
, event
.getLogLevel());
410 assertEquals(TraceEventType
.TRACEPOINT
, event
.getEventType());
411 assertEquals(TraceEnablement
.ENABLED
, event
.getState());
413 // verify getters and setters
414 verifyEventGettersSetters(event
);
418 assertEquals(TargetNodeState
.DISCONNECTED
, node
.getTargetNodeState());
419 assertNotNull(node
.getImage());
420 assertNotSame(connectedImage
, node
.getImage());
423 private void verifySessionGetterSetters(TraceSessionComponent session
) {
424 // save original values
425 String name
= session
.getName();
426 String origPath
= session
.getSessionPath();
427 TraceSessionState origState
= session
.getSessionState();
430 session
.setName("newName");
431 assertEquals("newName", session
.getName());
433 session
.setSessionPath("/home/user/tmp");
434 assertEquals("/home/user/tmp", session
.getSessionPath());
436 session
.setSessionState(TraceSessionState
.INACTIVE
);
437 assertEquals(TraceSessionState
.INACTIVE
, session
.getSessionState());
438 Image inactiveImage
= session
.getImage();
439 assertNotNull(inactiveImage
);
441 session
.setSessionState("active");
442 assertEquals(TraceSessionState
.ACTIVE
, session
.getSessionState());
444 Image activeImage
= session
.getImage();
445 assertNotNull(activeImage
);
446 assertNotSame(activeImage
, inactiveImage
);
449 // restore original values
450 session
.setName(name
);
451 session
.setSessionPath(origPath
);
452 session
.setSessionState(origState
);
455 private void verifyBaseEventGettersSetters(BaseEventComponent event
) {
456 // save original values
457 String name
= event
.getName();
458 TraceLogLevel level
= event
.getLogLevel();
459 TraceEventType type
= event
.getEventType();
462 event
.setName("newName");
463 assertEquals("newName", event
.getName());
465 event
.setLogLevel(TraceLogLevel
.TRACE_INFO
);
466 assertEquals(TraceLogLevel
.TRACE_INFO
, event
.getLogLevel());
467 event
.setLogLevel("TRACE_ALERT1");
468 assertEquals(TraceLogLevel
.TRACE_ALERT
, event
.getLogLevel());
470 event
.setEventType(TraceEventType
.UNKNOWN
);
471 assertEquals(TraceEventType
.UNKNOWN
, event
.getEventType());
472 event
.setEventType("tracepoint");
473 assertEquals(TraceEventType
.TRACEPOINT
, event
.getEventType());
475 // restore original values
477 event
.setLogLevel(level
);
478 event
.setEventType(type
);
481 private void verifyEventGettersSetters(TraceEventComponent event
) {
482 // save original values
483 String name
= event
.getName();
484 TraceLogLevel level
= event
.getLogLevel();
485 TraceEventType type
= event
.getEventType();
486 TraceEnablement state
= event
.getState();
489 event
.setName("newName");
490 assertEquals("newName", event
.getName());
492 event
.setLogLevel(TraceLogLevel
.TRACE_INFO
);
493 assertEquals(TraceLogLevel
.TRACE_INFO
, event
.getLogLevel());
494 event
.setLogLevel("TRACE_ALERT1");
495 assertEquals(TraceLogLevel
.TRACE_ALERT
, event
.getLogLevel());
497 event
.setEventType(TraceEventType
.UNKNOWN
);
498 assertEquals(TraceEventType
.UNKNOWN
, event
.getEventType());
499 event
.setEventType("tracepoint");
500 assertEquals(TraceEventType
.TRACEPOINT
, event
.getEventType());
502 event
.setState("disabled");
503 assertEquals(TraceEnablement
.DISABLED
, event
.getState());
505 Image disabledImage
= event
.getImage();
506 assertNotNull(disabledImage
);
508 event
.setState(TraceEnablement
.ENABLED
);
509 assertEquals(TraceEnablement
.ENABLED
, event
.getState());
511 Image enabledImage
= event
.getImage();
512 assertNotNull(enabledImage
);
513 assertNotSame(enabledImage
, disabledImage
);
515 // restore original values
517 event
.setLogLevel(level
);
518 event
.setEventType(type
);
519 event
.setState(state
);
522 private void verifyChannelGettersSetters(TraceChannelComponent channel
) {
523 // save original values
524 String name
= channel
.getName();
525 int nbSubBuffers
= channel
.getNumberOfSubBuffers();
526 String type
= channel
.getOutputType();
527 boolean mode
= channel
.isOverwriteMode();
528 long readTimer
= channel
.getReadTimer();
529 TraceEnablement state
= channel
.getState();
530 long subBufferSize
= channel
.getSubBufferSize();
531 long switchTimer
= channel
.getSwitchTimer();
534 channel
.setName("newName");
535 assertEquals("newName", channel
.getName());
537 channel
.setNumberOfSubBuffers(2);
538 assertEquals(2, channel
.getNumberOfSubBuffers());
540 channel
.setOutputType("splice()");
541 assertEquals("splice()", channel
.getOutputType());
543 channel
.setOverwriteMode(false);
544 assertEquals(false, channel
.isOverwriteMode());
546 channel
.setReadTimer(250);
547 assertEquals(250, channel
.getReadTimer());
549 channel
.setState("enabled");
550 assertEquals(TraceEnablement
.ENABLED
, channel
.getState());
552 Image enabledImage
= channel
.getImage();
553 assertNotNull(enabledImage
);
554 channel
.setState(TraceEnablement
.DISABLED
);
555 assertEquals(TraceEnablement
.DISABLED
, channel
.getState());
557 Image disabledImage
= channel
.getImage();
558 assertNotNull(disabledImage
);
559 assertNotSame(enabledImage
, disabledImage
);
561 channel
.setSubBufferSize(1024);
562 assertEquals(1024, channel
.getSubBufferSize());
564 channel
.setSwitchTimer(1000);
565 assertEquals(1000, channel
.getSwitchTimer());
567 // restore original values
568 channel
.setName(name
);
569 channel
.setNumberOfSubBuffers(nbSubBuffers
);
570 channel
.setOutputType(type
);
571 channel
.setOverwriteMode(mode
);
572 channel
.setReadTimer(readTimer
);
573 channel
.setState(state
);
574 channel
.setSubBufferSize(subBufferSize
);
575 channel
.setSwitchTimer(switchTimer
);
578 private void verifyUstProviderGettersSetters(UstProviderComponent ustProvider
) {
579 // save original values
580 String name
= ustProvider
.getName();
581 int pid
= ustProvider
.getPid();
584 ustProvider
.setName("newName");
585 assertEquals("newName", ustProvider
.getName());
587 ustProvider
.setPid(9876);
588 assertEquals(9876, ustProvider
.getPid());
590 // restore original values
591 ustProvider
.setName(name
);
592 ustProvider
.setPid(pid
);