Commit | Line | Data |
---|---|---|
eb1bab5b BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Bernd Hufmann - Initial API and implementation | |
11 | **********************************************************************/ | |
115b4a01 | 12 | package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component; |
eb1bab5b BH |
13 | |
14 | import java.util.LinkedList; | |
15 | import java.util.List; | |
16 | ||
17 | import junit.framework.Test; | |
18 | import junit.framework.TestCase; | |
19 | import junit.framework.TestSuite; | |
20 | ||
9315aeee | 21 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState; |
115b4a01 BH |
22 | import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy; |
23 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.ControlView; | |
24 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent; | |
25 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponentChangedListener; | |
115b4a01 BH |
26 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent; |
27 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlRoot; | |
28 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService; | |
29 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngControlService; | |
eb1bab5b BH |
30 | import org.eclipse.swt.graphics.Image; |
31 | import org.eclipse.ui.ISharedImages; | |
32 | import org.eclipse.ui.PlatformUI; | |
33 | import org.junit.After; | |
34 | import org.junit.Before; | |
35 | ||
36 | /** | |
37 | * The class <code>TraceControlComponentTest</code> contains tests for the class <code>{@link TraceControlComponent}</code>. | |
38 | * | |
39 | */ | |
40 | @SuppressWarnings("nls") | |
41 | public class TraceControlComponentTest extends TestCase { | |
42 | ||
43 | // ------------------------------------------------------------------------ | |
44 | // Test data | |
45 | // ------------------------------------------------------------------------ | |
46 | ||
47 | // ------------------------------------------------------------------------ | |
48 | // Static methods | |
49 | // ------------------------------------------------------------------------ | |
50 | ||
51 | /** | |
52 | * Returns test setup used when executing test case stand-alone. | |
53 | * @return Test setup class | |
54 | */ | |
55 | public static Test suite() { | |
56 | return new ModelImplTestSetup(new TestSuite(TraceControlComponentTest.class)); | |
57 | } | |
58 | ||
59 | // ------------------------------------------------------------------------ | |
60 | // Housekeeping | |
61 | // ------------------------------------------------------------------------ | |
62 | ||
63 | /** | |
64 | * Perform pre-test initialization. | |
65 | * | |
66 | * @throws Exception | |
67 | * if the initialization fails for some reason | |
68 | * | |
69 | */ | |
70 | @Override | |
71 | @Before | |
72 | public void setUp() throws Exception { | |
73 | } | |
74 | ||
75 | /** | |
76 | * Perform post-test clean-up. | |
77 | * | |
78 | * @throws Exception | |
79 | * if the clean-up fails for some reason | |
80 | * | |
81 | */ | |
82 | @Override | |
83 | @After | |
84 | public void tearDown() throws Exception { | |
85 | } | |
86 | ||
87 | /** | |
88 | * Run the TraceControlComponent(String) constructor test. | |
89 | */ | |
90 | public void testTraceControlComponent_1() | |
91 | throws Exception { | |
92 | ||
93 | String name = "node"; | |
94 | ||
95 | TraceControlComponent result = new TraceControlComponent(name); | |
96 | ||
97 | assertNotNull(result); | |
98 | assertEquals(name, result.getName()); | |
99 | assertEquals(null, result.getParent()); | |
100 | assertEquals(false, result.hasChildren()); | |
101 | assertEquals(null, result.getImage()); | |
102 | assertEquals(null, result.getControlService()); | |
103 | assertEquals(null, result.getToolTip()); | |
104 | } | |
105 | ||
106 | /** | |
107 | * Run the TraceControlComponent(String,ITraceControlComponent) constructor test. | |
108 | * | |
109 | */ | |
110 | public void testTraceControlComponent_2() | |
111 | throws Exception { | |
112 | String name = "node"; | |
113 | ||
114 | ITraceControlComponent parent = new TraceControlRoot(); | |
115 | TraceControlComponent result = new TraceControlComponent(name, parent); | |
116 | ||
117 | assertNotNull(result); | |
118 | assertEquals(name, result.getName()); | |
119 | assertEquals(false, result.hasChildren()); | |
120 | assertEquals(null, result.getImage()); | |
121 | assertEquals(null, result.getControlService()); | |
122 | assertEquals(null, result.getToolTip()); | |
123 | } | |
124 | ||
125 | /** | |
126 | * Run the void addChild(ITraceControlComponent) method test. | |
127 | * | |
128 | * @throws Exception | |
129 | * | |
130 | */ | |
131 | public void testAddAndGetChild1() | |
132 | throws Exception { | |
133 | TraceControlComponent fixture = new TraceControlComponent("node", new TraceControlRoot()); | |
134 | fixture.setToolTip("This is the test node"); | |
135 | fixture.addChild(new TraceControlRoot()); | |
136 | ITraceControlComponent component = new TraceControlRoot(); | |
137 | fixture.addChild(component); | |
138 | ||
139 | ITraceControlComponent child = fixture.getChild(TraceControlRoot.TRACE_CONTROL_ROOT_NAME); | |
140 | assertNotNull(child); | |
141 | assertEquals(TraceControlRoot.TRACE_CONTROL_ROOT_NAME, child.getName()); | |
142 | } | |
143 | ||
144 | /** | |
145 | * Run the void addChild(ITraceControlComponent) method test. | |
146 | * | |
147 | * @throws Exception | |
148 | * | |
149 | */ | |
150 | public void testAddAndGetChild2() | |
151 | throws Exception { | |
152 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
153 | fixture.setToolTip(""); | |
154 | ITraceControlComponent component = null; | |
155 | ||
156 | fixture.addChild(component); | |
157 | assertFalse(fixture.hasChildren()); | |
158 | } | |
159 | ||
160 | /** | |
161 | * Run the void addComponentListener(ITraceControlComponentChangedListener) method test. | |
162 | * | |
163 | * @throws Exception | |
164 | * | |
165 | */ | |
166 | ||
167 | public void testAddComponentListener_1() | |
168 | throws Exception { | |
169 | TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null); | |
170 | fixture.setToolTip(""); | |
171 | ||
172 | ListenerValidator validator = new ListenerValidator(); | |
173 | fixture.addComponentListener(validator); | |
174 | ||
175 | TraceControlRoot root = new TraceControlRoot(); | |
176 | fixture.addChild(root); | |
177 | assertTrue(validator.isAddedCalled()); | |
178 | ||
179 | fixture.removeChild(root); | |
180 | assertTrue(validator.isRemovedCalled()); | |
181 | ||
4775bcbf | 182 | fixture.fireComponentChanged(fixture); |
eb1bab5b BH |
183 | assertTrue(validator.isChangedCalled()); |
184 | } | |
185 | ||
186 | /** | |
187 | * Run the boolean containsChild(String) method test. | |
188 | * | |
189 | * @throws Exception | |
190 | * | |
191 | */ | |
192 | public void testContainsChild_1() | |
193 | throws Exception { | |
194 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
195 | fixture.setToolTip(""); | |
196 | fixture.addChild(new TraceControlRoot()); | |
197 | String name = "node"; | |
198 | ||
199 | boolean result = fixture.containsChild(name); | |
200 | ||
201 | assertEquals(false, result); | |
202 | } | |
203 | ||
204 | /** | |
205 | * Run the boolean containsChild(String) method test. | |
206 | * | |
207 | * @throws Exception | |
208 | * | |
209 | */ | |
210 | public void testContainsChild_2() | |
211 | throws Exception { | |
212 | TraceControlComponent fixture = new TraceControlComponent("name", new TraceControlRoot()); | |
213 | fixture.setToolTip(""); | |
214 | ||
215 | boolean result = fixture.containsChild(TraceControlRoot.TRACE_CONTROL_ROOT_NAME); | |
216 | ||
217 | assertEquals(false, result); | |
218 | } | |
219 | ||
220 | /** | |
221 | * Run the void fireCompenentAdded(ITraceControlComponent,ITraceControlComponent) method test. | |
222 | * Run the void fireCompenentRemoved(ITraceControlComponent,ITraceControlComponent) method test. | |
223 | * Run the void fireCompenentChanged(ITraceControlComponent) method test | |
224 | * | |
225 | * @throws Exception | |
226 | * | |
227 | */ | |
228 | ||
229 | public void testFireCompenentUpdated() | |
230 | throws Exception { | |
231 | ITraceControlComponent parent = new TraceControlRoot(); | |
232 | ||
233 | TraceControlComponent fixture = new TraceControlComponent("node", parent); | |
234 | fixture.setToolTip(""); | |
235 | ||
236 | ITraceControlComponent component = new TraceControlComponent("child"); | |
237 | fixture.addChild(component); | |
238 | ||
239 | ListenerValidator validator = new ListenerValidator(); | |
240 | fixture.addComponentListener(validator); | |
241 | ||
4775bcbf | 242 | fixture.fireComponentAdded(parent, component); |
eb1bab5b BH |
243 | assertTrue(validator.isAddedCalled()); |
244 | assertEquals(parent.getName(), validator.getSavedParent().getName()); | |
245 | assertEquals(component.getName(), validator.getSavedChild().getName()); | |
246 | ||
247 | validator.initialize(); | |
248 | ||
4775bcbf | 249 | fixture.fireComponentRemoved(parent, component); |
eb1bab5b BH |
250 | assertTrue(validator.isRemovedCalled()); |
251 | assertEquals(parent.getName(), validator.getSavedParent().getName()); | |
252 | assertEquals(component.getName(), validator.getSavedChild().getName()); | |
253 | ||
254 | validator.initialize(); | |
4775bcbf | 255 | fixture.fireComponentChanged(fixture); |
eb1bab5b BH |
256 | assertTrue(validator.isChangedCalled()); |
257 | assertEquals(fixture.getName(), validator.getSavedComponent().getName()); | |
258 | } | |
259 | ||
260 | /** | |
261 | * Run the Object getAdapter(Class) method test. | |
262 | * | |
263 | * @throws Exception | |
264 | * | |
265 | */ | |
266 | ||
267 | public void testGetAdapter() | |
268 | throws Exception { | |
269 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
270 | fixture.setToolTip(""); | |
271 | fixture.addChild(new TraceControlRoot()); | |
272 | Class<Object> adapter = Object.class; | |
273 | ||
274 | Object result = fixture.getAdapter(adapter); | |
275 | ||
276 | assertEquals(null, result); | |
277 | } | |
278 | ||
279 | /** | |
280 | * Run the ITraceControlComponent[] getChildren() method test. | |
281 | * | |
282 | * @throws Exception | |
283 | * | |
284 | */ | |
285 | public void testGetChildren_1() | |
286 | throws Exception { | |
287 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
288 | fixture.setToolTip(""); | |
289 | fixture.addChild(new TraceControlRoot()); | |
290 | ||
291 | ITraceControlComponent[] result = fixture.getChildren(); | |
292 | ||
293 | assertNotNull(result); | |
294 | assertEquals(1, result.length); | |
295 | assertNotNull(result[0]); | |
296 | assertEquals("trace_control_root", result[0].getName()); | |
297 | assertEquals(null, result[0].getParent()); | |
298 | assertEquals(false, result[0].hasChildren()); | |
299 | assertEquals(null, result[0].getImage()); | |
300 | assertEquals(null, result[0].getControlService()); | |
301 | assertEquals(null, result[0].getToolTip()); | |
302 | } | |
303 | ||
304 | /** | |
305 | * Run the ILttngControlService getControlService()/setControlService() method test. | |
306 | * | |
307 | * @throws Exception | |
308 | * | |
309 | */ | |
310 | public void testGetAndSetControlService_1() | |
311 | throws Exception { | |
312 | ||
313 | TraceControlComponent parent = new TraceControlComponent("parent") { | |
314 | ILttngControlService fService = null; | |
315 | ||
316 | @Override | |
317 | public void setControlService(ILttngControlService service ) { | |
318 | fService = service; | |
319 | } | |
320 | ||
321 | @Override | |
322 | public ILttngControlService getControlService() { | |
323 | return fService; | |
324 | } | |
325 | }; | |
326 | ||
327 | TraceControlComponent fixture = new TraceControlComponent("", parent); | |
328 | parent.addChild(fixture); | |
329 | fixture.setToolTip(""); | |
330 | TraceControlComponent child = new TraceControlComponent("child", fixture); | |
331 | fixture.addChild(child); | |
332 | ||
333 | ILttngControlService result = fixture.getControlService(); | |
334 | assertEquals(null, result); | |
335 | ||
336 | TestRemoteSystemProxy proxy = new TestRemoteSystemProxy(); | |
337 | ILttngControlService service = new LTTngControlService(proxy.createCommandShell()); | |
338 | fixture.setControlService(service); | |
339 | result = fixture.getControlService(); | |
340 | assertNotNull(service); | |
341 | assertEquals(service, result); | |
342 | ||
343 | result = fixture.getChildren()[0].getControlService(); | |
344 | assertNotNull(service); | |
345 | assertEquals(service, result); | |
346 | } | |
347 | ||
348 | /** | |
349 | * Run the Image getImage() method test. | |
350 | * | |
351 | * @throws Exception | |
352 | * | |
353 | */ | |
354 | public void testGetImage_1() | |
355 | throws Exception { | |
356 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
357 | fixture.setToolTip(""); | |
358 | fixture.addChild(new TraceControlRoot()); | |
359 | ||
360 | Image result = fixture.getImage(); | |
361 | assertEquals(null, result); | |
362 | ||
363 | fixture.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER)); | |
364 | assertNotNull(fixture.getImage()); | |
365 | } | |
366 | ||
367 | /** | |
368 | * Run the boolean hasChildren() method test. | |
369 | * | |
370 | * @throws Exception | |
371 | * | |
372 | */ | |
373 | public void testHasChildren_1() | |
374 | throws Exception { | |
375 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
376 | fixture.setToolTip(""); | |
377 | fixture.addChild(new TraceControlRoot()); | |
378 | ||
379 | boolean result = fixture.hasChildren(); | |
380 | ||
381 | assertTrue(result); | |
382 | } | |
383 | ||
384 | /** | |
385 | * Run the boolean hasChildren() method test. | |
386 | * | |
387 | * @throws Exception | |
388 | * | |
389 | */ | |
390 | public void testHasChildren_2() | |
391 | throws Exception { | |
392 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
393 | fixture.setToolTip(""); | |
394 | ||
395 | boolean result = fixture.hasChildren(); | |
396 | ||
397 | assertFalse(result); | |
398 | } | |
399 | ||
400 | /** | |
401 | * Run the void removeAllChildren() method test. | |
402 | * | |
403 | * @throws Exception | |
404 | * | |
405 | */ | |
406 | public void testRemoveAllChildren_2() | |
407 | throws Exception { | |
408 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
409 | fixture.setToolTip(""); | |
410 | ||
411 | fixture.addChild(new TraceControlRoot()); | |
412 | fixture.addChild(new TraceControlComponent("child")); | |
413 | ||
414 | fixture.removeAllChildren(); | |
415 | assertFalse(fixture.hasChildren()); | |
416 | } | |
417 | ||
418 | /** | |
419 | * Run the void removeChild(ITraceControlComponent) method test. | |
420 | * | |
421 | * @throws Exception | |
422 | * | |
423 | */ | |
424 | public void testRemoveChild_1() | |
425 | throws Exception { | |
426 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
427 | fixture.setToolTip(""); | |
428 | TraceControlComponent child = new TraceControlComponent("child", fixture); | |
429 | ||
430 | fixture.addChild(child); | |
431 | fixture.removeChild(child); | |
432 | assertFalse(fixture.hasChildren()); | |
433 | } | |
434 | ||
435 | /** | |
436 | * Run the void removeChild(ITraceControlComponent) method test. | |
437 | * | |
438 | * @throws Exception | |
439 | * | |
440 | */ | |
441 | ||
442 | public void testRemoveChild_2() | |
443 | throws Exception { | |
444 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
445 | fixture.setToolTip(""); | |
446 | fixture.addChild(new TraceControlRoot()); | |
447 | ITraceControlComponent component = null; | |
448 | ||
449 | fixture.removeChild(component); | |
450 | assertTrue(fixture.hasChildren()); | |
451 | } | |
452 | ||
453 | /** | |
454 | * Run the void removeComponentListener(ITraceControlComponentChangedListener) method test. | |
455 | * | |
456 | * @throws Exception | |
457 | * | |
458 | */ | |
459 | public void testRemoveComponentListener_1() | |
460 | throws Exception { | |
461 | TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null); | |
462 | fixture.setToolTip(""); | |
463 | ||
464 | ListenerValidator validator = new ListenerValidator(); | |
465 | fixture.addComponentListener(validator); | |
466 | ||
467 | // Remove listener and check that validator is not called anymore | |
468 | validator.initialize(); | |
469 | fixture.removeComponentListener(validator); | |
470 | TraceControlRoot root = new TraceControlRoot(); | |
471 | fixture.addChild(root); | |
472 | assertFalse(validator.isAddedCalled()); | |
473 | ||
474 | fixture.removeChild(root); | |
475 | assertFalse(validator.isRemovedCalled()); | |
476 | ||
4775bcbf | 477 | fixture.fireComponentChanged(fixture); |
eb1bab5b BH |
478 | assertFalse(validator.isChangedCalled()); |
479 | } | |
480 | ||
481 | /** | |
482 | * Run the void removeComponentListener(ITraceControlComponentChangedListener) method test. | |
483 | * | |
484 | * @throws Exception | |
485 | * | |
486 | */ | |
487 | public void testRemoveComponentListener_2() | |
488 | throws Exception { | |
489 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
490 | fixture.setToolTip(""); | |
491 | fixture.addChild(new TraceControlRoot()); | |
492 | ITraceControlComponentChangedListener listener = new ControlView(); | |
493 | ||
494 | fixture.removeComponentListener(listener); | |
495 | ||
496 | } | |
497 | ||
498 | /** | |
499 | * Run the void setChildren(List<ITraceControlComponent>)/ITraceControlComponent[] getChildren() method test. | |
500 | * | |
501 | * | |
502 | * @throws Exception | |
503 | * | |
504 | */ | |
505 | public void testGetAndSetChildren() | |
506 | throws Exception { | |
507 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
508 | fixture.setToolTip(""); | |
509 | List<ITraceControlComponent> children = new LinkedList<ITraceControlComponent>(); | |
510 | children.add(new TraceControlComponent("child1")); | |
511 | children.add(new TraceControlComponent("child2")); | |
512 | ||
513 | fixture.setChildren(children); | |
514 | ||
515 | ITraceControlComponent[] result = fixture.getChildren(); | |
516 | assertEquals(2, result.length); | |
517 | assertEquals("child1", result[0].getName()); | |
518 | assertEquals("child2", result[1].getName()); | |
519 | } | |
520 | ||
521 | /** | |
522 | * Run the void String getName()/setName(String) method tests. | |
523 | * | |
524 | * @throws Exception | |
525 | * | |
526 | */ | |
527 | public void testGetAndSetName() | |
528 | throws Exception { | |
529 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
530 | fixture.setToolTip(""); | |
531 | fixture.addChild(new TraceControlRoot()); | |
532 | String name = "node"; | |
533 | ||
534 | fixture.setName(name); | |
535 | assertEquals(name,fixture.getName()); | |
536 | ||
537 | } | |
538 | ||
539 | /** | |
540 | * Run the void ITraceControlComponent getParent()/setParent(ITraceControlComponent) method tests. | |
541 | * | |
542 | * @throws Exception | |
543 | * | |
544 | */ | |
545 | public void testGetAndSetParent() | |
546 | throws Exception { | |
547 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
548 | fixture.setToolTip(""); | |
549 | fixture.addChild(new TraceControlRoot()); | |
550 | ITraceControlComponent parent = new TraceControlRoot(); | |
551 | parent.addChild(fixture); | |
552 | ||
553 | fixture.setParent(parent); | |
554 | ITraceControlComponent retrievedParent = fixture.getParent(); | |
555 | assertNotNull(retrievedParent); | |
556 | assertEquals(parent.getName(), retrievedParent.getName()); | |
557 | assertEquals(TraceControlRoot.TRACE_CONTROL_ROOT_NAME, retrievedParent.getName()); | |
558 | assertEquals(null, retrievedParent.getParent()); | |
559 | assertEquals(true, retrievedParent.hasChildren()); | |
560 | } | |
561 | ||
562 | /** | |
563 | * Run the void TargetNodeState getTargetNodeState()/etTargetNodeState(TargetNodeState) method tests. | |
564 | * | |
565 | * @throws Exception | |
566 | * | |
567 | */ | |
568 | public void testGetAndSetTargetNodeState_1() | |
569 | throws Exception { | |
570 | ||
571 | TraceControlComponent parent = new TraceControlComponent("parent") { | |
572 | private TargetNodeState fState; | |
573 | ||
574 | @Override | |
575 | public void setTargetNodeState(TargetNodeState state ) { | |
576 | fState = state; | |
577 | } | |
578 | ||
579 | @Override | |
580 | public TargetNodeState getTargetNodeState() { | |
581 | return fState; | |
582 | } | |
583 | }; | |
584 | ||
585 | TraceControlComponent fixture = new TraceControlComponent("", parent); | |
586 | parent.addChild(fixture); | |
587 | ||
588 | fixture.setToolTip(""); | |
589 | TargetNodeState state = TargetNodeState.CONNECTED; | |
590 | ||
591 | fixture.setTargetNodeState(state); | |
592 | TargetNodeState result = fixture.getTargetNodeState(); | |
593 | ||
594 | assertNotNull(result); | |
595 | assertEquals(state, result); | |
596 | // Check also parent | |
597 | assertEquals(state, fixture.getParent().getTargetNodeState()); | |
598 | assertEquals("CONNECTED", result.name()); | |
599 | assertEquals("CONNECTED", result.toString()); | |
600 | assertEquals(2, result.ordinal()); | |
601 | ||
602 | fixture.setTargetNodeState(TargetNodeState.DISCONNECTED); | |
603 | result = fixture.getTargetNodeState(); | |
604 | assertNotNull(result); | |
605 | assertEquals("DISCONNECTED", result.name()); | |
606 | assertEquals("DISCONNECTED", result.toString()); | |
607 | assertEquals(0, result.ordinal()); | |
608 | ||
609 | state = TargetNodeState.CONNECTING; | |
610 | ||
611 | fixture.setTargetNodeState(state); | |
612 | result = fixture.getTargetNodeState(); | |
613 | assertNotNull(result); | |
614 | assertEquals("CONNECTING", result.name()); | |
615 | assertEquals("CONNECTING", result.toString()); | |
616 | assertEquals(3, result.ordinal()); | |
617 | ||
618 | fixture.setTargetNodeState(TargetNodeState.DISCONNECTING); | |
619 | result = fixture.getTargetNodeState(); | |
620 | assertNotNull(result); | |
621 | assertEquals("DISCONNECTING", result.name()); | |
622 | assertEquals("DISCONNECTING", result.toString()); | |
623 | assertEquals(1, result.ordinal()); | |
624 | ||
625 | } | |
626 | ||
627 | /** | |
628 | * Run the void setToolTip(String) method test. | |
629 | * | |
630 | * @throws Exception | |
631 | * | |
632 | ||
633 | */ | |
634 | ||
635 | public void testGetSndSetToolTip() | |
636 | throws Exception { | |
637 | TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); | |
638 | fixture.setToolTip("This is a tooltip"); | |
639 | fixture.addChild(new TraceControlRoot()); | |
640 | ||
641 | String result = fixture.getToolTip(); | |
642 | ||
643 | assertEquals("This is a tooltip", result); | |
644 | } | |
645 | } |